我尝试运行两次MOJO的exec plugin,但它抱怨mainClass没有设置。使用这个my.Main,我想要生成几个文件,它们必须在编译阶段之前完成。我做错什么了?mainClass是为这两种执行设置的,并带有正确的参数。
我的pom.xml包含以下内容:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>ABC_FALSE</id>
<phase>generate-sources</phase>
<configuration>
<mainClass>my.Main</mainClass>
<arguments>
<argument>-abc</argument>
<argument>false</argument>
</arguments>
</configuration>
<goals>
<goal>java</goal>
</goals>
</execution>
<execution>
<id>ABC_TRUE</id>
<phase>generate-sources</phase>
<configuration>
<mainClass>my.Main</mainClass>
<arguments>
<argument>-abc</argument>
<argument>true</argument>
</arguments>
</configuration>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
</plugin>跑后
mvn exec:java我知道这个错误
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project exec-generation: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java are missing or invalid.向你问好,SK
发布于 2014-11-25 19:11:25
试试这个:
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>exucute_the_executable_jar_1</id>
<phase>generate-resources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>the.Main</mainClass>
<arguments>
<argument>a</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>exucute_the_executable_jar_2</id>
<phase>generate-resources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>the.Main</mainClass>
<arguments>
<argument>b</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
...通过使用以下命令调用maven:
mvn package好的,我在generate-resources阶段使用了它,但是您可以更改它。
向你问好,格拉夫尔
https://stackoverflow.com/questions/27124374
复制相似问题