我正在尝试使用Maven插件Failsafe来运行src / it / java目录中的集成测试。我正在使用build-helper插件来获取集成测试资源
我将故障安全插件设置为...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<printSummary>true</printSummary>
</configuration>
</plugin>
使用我的构建助手插件设置...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>
<directory>src/it/java</directory>
</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/it/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
我也有Surefire插件来运行我的单元测试...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
当我执行mvn clean验证时,当我尝试执行mvn failsafe时,只有以surefire运行的单元测试不会运行,并且不会运行故障安全:当我尝试执行mvn build-helper:add-test-sources failsafe时,验证没有测试运行:验证,它会引发一个错误,即找不到测试源。
[ERROR] Failed to execute goal org.codehaus.mojo:build-helper-maven-plugin:3.0.0:add-test-source (default-cli) on project stkweb: The parameters 'sources' for goal org.codehaus.mojo:build-helper-maven-plugin:3.0.0:add-test-source are missing or invalid -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
现在,如果我稍微更改一下surefire的配置,并将集成测试放在src / test / java文件夹中,它将可以很好地运行它们。出于设计原因,我们只是希望将它们放在单独的目录中。
答案 0 :(得分:0)
问题归结于使用set (CMAKE_CXX_STANDARD 11)
标签。
<pluginManagement>
当我删除pluginManagement标记时,它开始运行FailSafe。
<build>
<pluginManagement>
<plugins>
</plugins>
</pluginManagement>
</build>
这也解决了我们在直接致电Jacoco之前与Jacoco所遇到的问题。