执行Maven-Maven-Plugin
执行myplugin(取决于步骤1)
再次执行myplugin
我的解决方案是将自己插件中的所有执行组合在一起以控制确切的顺序,但我认为这不是最好的方法。谢谢! <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>assembly1</id>
<goals>
<goal>assembly</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
<execution>
<id>assembly2</id>
<goals>
<goal>assembly</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
seq-maven-plugin
为此。
<plugin>
<groupId>io.github.qudtlib</groupId>
<artifactId>seq-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>run-sequence</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<label>My Sequence</label>
<steps>
<step>
<pluginCoordinates>assembly:assembly@first<pluginCoordinates>
</step>
<step>
<pluginCoordinates>myplugin:mygoal@firstExec<pluginCoordinates>
</step>
<step>
<pluginCoordinates>assembly:assembly@second<pluginCoordinates> </step>
<step>
<pluginCoordinates>myplugin:mygoal@secondExec<pluginCoordinates>
</step>
</steps>
</configuration>
</execution>
</executions>
</plugin>
<!-- executions of the plugins you want, using <phase> none </phase>. Exemplified with assembly plugin, the myplugin:mygoal@firstExec and myplugin:mygoal@secondExec config is omitted here
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>assembly</goal>
</goals>
<phase>none</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
<execution>
<id>second</id>
<goals>
<goal>assembly</goal>
</goals>
<phase>none</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>