我正在使用maven 2并在* IT.java文件中进行集成测试。当我运行命令mvn failsafe:integration-test
集成测试运行罚款。但是,当我运行mvn integration-test
它不会运行我的集成测试。我如何删除前缀failsafe:
?
在pom.xml中我使用:mvn failsafe:integration-test
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
UPDATE
我也试过以下pom.xml
安装,然后mvn clean verify
。我只有JUnit测试的肯定报告。在控制台输出上仍然缺少JUnit集成测试。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
现在我通过插件的设置绑禁用单元测试:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Disable unit tests -->
<skip>true</skip>
</configuration>
</plugin>
文我跑mvn clean verify
我的故障保护的集成测试运行!但是为什么它不能和单元测试一起工作呢?任何想法?
你是从哪里定义的?在建立区或插件管理区? – khmarbaise 2012-08-09 14:41:55
里面''区域 –
martin
2012-08-09 14:43:41
您是否明确指定了阶段?我帮助了其他[类似问题]的其他人(http://stackoverflow.com/a/9949341/944849),并增加了阶段。这个目标应该被默认绑定到每个文档的“集成测试”阶段,但是直到阶段被明确添加之后才会起作用。 – user944849 2012-08-09 15:54:05