【发布时间】:2016-10-17 22:40:28
【问题描述】:
我正在使用 exec-maven-plugin 在 maven 项目中运行 JavaScript 单元测试
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>run-karma</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${node.bin.folder}/node</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>node_modules/karma/bin/karma</argument>
<argument>start</argument>
<argument>--single-run</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
我假设如果我通过了-DskipTests,整个测试阶段将被跳过,但事实并非如此,skipTests flag is only honored when using "Surefire, Failsafe and the Compiler Plugin"
问题:我怎样才能使执行取决于skipTests 标志?
【问题讨论】:
-
我猜你要么将运行 karma 测试包装到一个脚本中,如果设置了 skipTests 属性,然后决定运行 node/karma 命令。另一种解决方案可能是将此配置移动到配置文件中并使用激活:maven.apache.org/pom.html#Activation 或仅在需要时激活它。
标签: maven maven-3 pom.xml exec-maven-plugin