我正在开展基于maven的项目。项目有多个模块。 这是项目结构
- 项目
--Module1 -- pom.xml --Module2 -- pom.xml --Module3-war -- pom.xml --parent module --pom.xml
父模块包装类型为“pom”,所有模块都在此定义 我在父模块pom中添加了failsafe-pligin,如下所示
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
现在,当我运行“mvn verify”命令时,failafe插件没有被执行。 我的集成测试名称“TestServiceIT.java”位于结构的module1中。
当我在我的war模块中添加相同的“failsafe”插件时,我发现在创建WAR之后会执行failafe插件但是找不到测试类。见下文
[INFO] Started Jetty Server
[INFO]
[INFO] --- maven-failsafe-plugin:2.15:integration-test (integration-test) @ service-integration-test
---
[INFO] No tests to run.
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform d
endent!
[INFO]
[INFO] --- jetty-maven-plugin:8.1.11.v20130520:stop (stop-jetty) @ service-integration-test ---
[INFO]
[INFO] --- maven-failsafe-plugin:2.15:verify (verify) @ service-integration-test ---
[INFO] No tests to run.
所以,我的问题是
答案 0 :(得分:0)
我认为您必须在故障安全插件配置中添加dependenciesToScan。 即:
<dependencies>
<dependency>
<groupId>org.arquillian.tck.container</groupId>
<artifactId>arquillian-tck-container</artifactId>
<version>1.0.0.Final-SNAPSHOT</version>
<classifier>tests</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14-SNAPSHOT</version>
<configuration>
<dependenciesToScan>
<dependency>org.arquillian.tck.container:arquillian-tck-container</dependency>
</dependenciesToScan>
</configuration>
</plugin>
</plugins>
</build>
,我无法测试它