我有2个目标。
1)全新安装 2)exec:java
每当我运行目标“ mvn clean install”时,它就会被执行,如果构建成功,它将直接触发exec:java目标。但是,如果maven构建失败,则不会触发“ exec:java”作业。无论结果如何,我都想运行Java作业。
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<forkCount>0</forkCount>
<!-- <systemPropertyVariables>
<environment>${TestSuiteName}</environment>
</systemPropertyVariables> -->
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>send-report</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.acxsys.ocp.api.emt.ks.report.KSSendEmail</mainClass>
</configuration>
</plugin>
答案 0 :(得分:0)
尝试使用mvn -fn clean install
-fn
表示永不失败,它将始终继续执行目标。