Java 将maven assembly插件绑定到包阶段两次时执行顺序错误

Java 将maven assembly插件绑定到包阶段两次时执行顺序错误,java,maven,Java,Maven,我想使用proguard maven插件在两个程序集描述符(一个是文件夹格式,一个是zip格式)之间执行,所以我定义了我的pom: <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <

我想使用proguard maven插件在两个程序集描述符(一个是文件夹格式,一个是zip格式)之间执行,所以我定义了我的pom:

         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>raw-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <appendAssemblyId>false</appendAssemblyId>
                        <finalName>raw</finalName>
                        <descriptors>
                            <descriptor>src/assemble/raw.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>com.github.wvengen</groupId>
            <artifactId>proguard-maven-plugin</artifactId>
            <version>2.0.7</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>proguard</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <options>
                    <option>@${project.build.directory}/raw/proguard/proguard.cfg</option>
                </options>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>distro-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <appendAssemblyId>false</appendAssemblyId>
                        <finalName>distro</finalName>
                        <descriptors>
                            <descriptor>src/assemble/distro.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

maven汇编插件
原始装配
包裹
单一的
假的
未经加工的
src/assemble/raw.xml
com.github.wvengen
proguard maven插件
2.0.7
包裹
前卫
@${project.build.directory}/raw/proguard/proguard.cfg
maven汇编插件
发行版组装
包裹
单一的
假的
发行版
src/assemble/distro.xml
但是maven汇编插件总是在proguard插件之前执行2个描述符

我使用Maven 3.2.2


谢谢,

程序包拼写错误

<plugin>
    <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.7</version>
        <executions>
            <execution>
                <phase>packge</phase>    <--- Spelling Issue

com.github.wvengen
proguard maven插件
2.0.7

packge程序中的Package拼写错误

<plugin>
    <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.7</version>
        <executions>
            <execution>
                <phase>packge</phase>    <--- Spelling Issue

com.github.wvengen
proguard maven插件
2.0.7

packge程序中的Package拼写错误

<plugin>
    <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.7</version>
        <executions>
            <execution>
                <phase>packge</phase>    <--- Spelling Issue

com.github.wvengen
proguard maven插件
2.0.7

packge程序中的Package拼写错误

<plugin>
    <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.7</version>
        <executions>
            <execution>
                <phase>packge</phase>    <--- Spelling Issue

com.github.wvengen
proguard maven插件
2.0.7

packge在确定运行顺序时,Maven首先运行绑定到生命周期早期阶段的目标。如果多个目标绑定到同一阶段,那么它们将按照POM中列出的顺序运行

当你想运行一个插件不止一次的时候,你不会像你所展示的那样添加两次插件,而是在一个插件中执行多次。如果希望在程序集之前执行proguard插件,可以将目标绑定到早期阶段(例如,
prepare package
)。如果出于某种原因,阶段必须是
package
,那么proguard插件配置必须出现在文件中程序集插件配置之前

如果您需要在执行proguard插件之前运行第一个程序集执行,在执行之后运行第二个程序集执行,那么您需要使用两个阶段。proguard插件配置需要在程序集插件之前出现在文件中,执行应该使用phase
package
。第一次程序集执行应使用
准备包
,第二次

这是重新安排的POM,所有内容都绑定到
阶段,如原始问题所示

    <plugin>
        <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.7</version>
        <executions>
            <execution>
                <phase>package</phase>  <!-- fixed spelling -->
                <goals>
                    <goal>proguard</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <options>
                <option>@${project.build.directory}/raw/proguard/proguard.cfg</option>
            </options>
        </configuration>
    </plugin>

     <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
            <execution>
                <id>raw-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>raw</finalName>
                    <descriptors>
                        <descriptor>src/assemble/raw.xml</descriptor>
                    </descriptors>
                </configuration>
            </execution>
            <execution>
                <id>distro-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>distro</finalName>
                    <descriptors>
                        <descriptor>src/assemble/distro.xml</descriptor>
                    </descriptors>
                </configuration>
            </execution>
        </executions>
    </plugin>

com.github.wvengen
proguard maven插件
2.0.7
包裹
前卫
@${project.build.directory}/raw/proguard/proguard.cfg
maven汇编插件
原始装配
包裹
单一的
假的
未经加工的
src/assemble/raw.xml
发行版组装
包裹
单一的
假的
发行版
src/assemble/distro.xml

在确定运行顺序时,Maven首先运行绑定到生命周期早期阶段的目标。如果多个目标绑定到同一阶段,那么它们将按照POM中列出的顺序运行

当你想运行一个插件不止一次的时候,你不会像你所展示的那样添加两次插件,而是在一个插件中执行多次。如果希望在程序集之前执行proguard插件,可以将目标绑定到早期阶段(例如,
prepare package
)。如果出于某种原因,阶段必须是
package
,那么proguard插件配置必须出现在文件中程序集插件配置之前

如果您需要在执行proguard插件之前运行第一个程序集执行,在执行之后运行第二个程序集执行,那么您需要使用两个阶段。proguard插件配置需要在程序集插件之前出现在文件中,执行应该使用phase
package
。第一次程序集执行应使用
准备包
,第二次

这是重新安排的POM,所有内容都绑定到
阶段,如原始问题所示

    <plugin>
        <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.7</version>
        <executions>
            <execution>
                <phase>package</phase>  <!-- fixed spelling -->
                <goals>
                    <goal>proguard</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <options>
                <option>@${project.build.directory}/raw/proguard/proguard.cfg</option>
            </options>
        </configuration>
    </plugin>

     <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
            <execution>
                <id>raw-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>raw</finalName>
                    <descriptors>
                        <descriptor>src/assemble/raw.xml</descriptor>
                    </descriptors>
                </configuration>
            </execution>
            <execution>
                <id>distro-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>distro</finalName>
                    <descriptors>
                        <descriptor>src/assemble/distro.xml</descriptor>
                    </descriptors>
                </configuration>
            </execution>
        </executions>
    </plugin>

com.github.wvengen
proguard maven插件
2.0.7
包裹
前卫