Maven打包异常:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin。
出现位置大概是因为test模块的测试类打包没通过。
解决办法一:
把测试类注掉。(管用,但测试类多的话就比较麻烦)
方法二:
在pom文件中在sureFIre依赖处添加: <skipTests>true</skipTests>
直译为跳过测试类。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<includes>
<include></include>
</includes>
<argLine>-Xmx256M</argLine>
<skipTests>true</skipTests>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.15</version>
</dependency>
</dependencies>
</plugin>
注:
(添加完依赖最好先clean一下,再刷新maven,package,或者使用命令:mvn clean package -DskipTests -U (跳过测试))