1
我在訂購Maven插件時遇到問題。 我想聲明的順序執行的插件:Maven插件執行順序
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>task-1</id>
<goals>
<goal>run</goal>
</goals>
<phase>initialize</phase>
<configuration>
<target>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>task-2</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<executable>cmd</executable>
<arguments>
<argument>/c</argument>
<argument>rem</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>task-3</id>
<goals>
<goal>run</goal>
</goals>
<phase>initialize</phase>
<configuration>
<target>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我所期望的執行順序:任務1,任務2,任務3
但執行mvn initialize
後,實際的訂單任務-1,task-3,task-2:
[INFO] --- maven-antrun-plugin:1.3:run (task-1) @ test ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (task-3) @ test ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:exec (task-2) @ test ---
我應該改變什麼來執行我想要的插件?
感謝您的解釋。是的,有一個「重複的插件聲明」警告。此外,這是Maven執行模式中的一個巨大限制。 – snorbi