我正在尝试执行Maven阶段: mvn测试
但是,测试未执行:
我运行mvn -X测试以获取更多输出,并且看起来正在搜索以下模式:
<includes>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
</includes>
我认为此插件的默认值为:
<includes>
<include>**/Test*.java</include>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
</includes>
无论如何,我的pom.xml的一部分如下:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
任何想法请帮忙。谢谢。
答案 0 :(得分:0)
这是因为我在模块内使用了以下spring boot插件:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
这将更改搜索条件,以查找以Test或Tests结尾的测试类。 以下链接帮助: Spring Boot - My unit tests are being skipped正在跳过测试
我更改了模块中的surefire插件以覆盖此配置。