我在我的Spring Framework项目中有maven设置,并且我有一个测试,但是无法测试我的构建失败(运行maven test
)。我的Spring项目配置了Maven Multi Module。下面的POM xml是我的父POM。该测试在子POM中失败,但maven install
构建了所有项目。
这是我的父maven插件配置:
<build>
<finalName>cointraders-website</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
</plugin>
</plugins>
</build>
儿童maven pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>unit-tests</id>
<phase>unit-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<includes>
<include>**/*UnitTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</plugin>
控制台登录成功:
[INFO] parent-project .................................... SUCCESS [ 1.327 s]
[INFO] xxxxx-data .................................. SUCCESS [01:41 min]
[INFO] xxxxx-commandline ........................... SUCCESS [ 2.597 s]
[INFO] xxxxx-api ................................... SUCCESS [ 54.613 s]
测试失败发生在xxxxx-data子项目中:
Tests run: 204, Failures: 1, Errors: 0, Skipped: 0