【发布时间】:2010-02-11 09:20:29
【问题描述】:
如何在构建期间或构建刚刚完成之后执行 Java 程序?是否可以直接从 pom 中执行此操作?
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main
编辑
假设我想执行org.eclipse.content.MyClass。我需要如何编写代码?
这会构建项目,但不会执行我的课程:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.eclipse.content.MyClass</mainClass>
</configuration>
</plugin>
【问题讨论】: