由于maven exec插件,生成未完成



我有一个多模块maven项目,有一个父pom和多个子pom。

在运行maven install时,我的最后一个模块使用了maven-exec插件,并运行了某个类的main方法。问题是,一旦主方法完成运行,构建似乎就停止了。

这是我的设置:

来自我父母的pom:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skip>true</skip>
<executable>java</executable>
</configuration>
</plugin>

来自我的孩子pom:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.example.MainClass</mainClass>
<async>true</async>
<keepAlive>true</keepAlive>
</configuration>
</execution>
</executions>
</plugin>

我试着加入

<async>true</async>
<keepAlive>true</keepAlive>

但是在执行主方法之后它仍然停止。我最终看不到构建成功。。。

解决方案是使用exec:exec,而不是exec:java,因为exec:java和maven构建在同一个进程上运行,而exec:xec在不同的进程上运行。

最新更新