Ler*_*erp 12 compilation exec phase maven
我正在尝试设置我的POM,这样当我这样做mvn exec:exec
或者mvn exec:java
它将首先编译源并且iff成功时,执行它.
我有以下内容,并试图移动<execution>
部分,但无法让它工作:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<executions>
<execution>
<phase>exec</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>my.main.class</mainClass>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
当我做任何一个mvn exec:exec ...
或mvn exec:java
它没有先编译.我已经尝试将该<execution>
部分放入exec
插件部分,但这也不起作用?
您可以将 exec 插件绑定到构建生命周期compile
中的后续阶段(在下面的示例中):verify
<profile>
<id>proxy</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<mainClass>my.main.class</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud)
并比跑mvn verify
。
我看到答案已经很晚了,您可能已经找到了解决方案。我只是留下来作为其他可能有需要的人的参考。
归档时间: |
|
查看次数: |
4164 次 |
最近记录: |