我的 pom 中有以下 exec 任务:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${project.basedir}/src/test/javascript/EnvJasmine/bin/run_all_tests.sh</executable>
</configuration>
</plugin>
</plugins>
这在我运行时效果很好
mvn exec:exec
但我也希望它在我执行时运行
mvn test
有人能帮我一下吗?
最佳答案
知道了!您将 <phase>
添加到执行中!
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>Jasmine Tests</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${project.basedir}/src/test/javascript/EnvJasmine/bin/run_all_tests.sh</executable>
</configuration>
</plugin>
</plugins>
呜呼!
关于java - 如何添加 Maven exec 任务以在 `mvn test` 上执行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4821686/