当我以下列方式调用exec:java
目标时,我试图让Maven exec插件运行多次执行:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.example.First</mainClass>
</configuration>
</execution>
<execution>
<id>second</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.example.Second</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
但是在使用maven 3.1.1运行mvn exec:java
时,我收到错误消息:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project test: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [Help 1]
为单次执行运行exec:java
目标(不使用嵌套的executions
元素)按预期工作。
答案 0 :(得分:2)
在我看来,问题是<execution/>
都与特定的<phase/>
无关。尝试设置一个。