日期:2014-05-17  浏览次数:20901 次

maven3使用junit4时需指定org.apache.maven.surefire为surefire-junit47
maven3使用junit4时需指定
org.apache.maven.surefire为surefire-junit47,不然会报如下异常:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project xxx: There are test failures.


在apache官网对此插件有详细的说明:
http://maven.apache.org/plugins/maven-surefire-plugin/examples/junit.html

pom.xml中的配置如下:

<build>
  	<plugins>
  	  <plugin>
	    <groupId>org.apache.maven.plugins</groupId>
	    <artifactId>maven-surefire-plugin</artifactId>
	    <version>2.12</version>
	    <dependencies>
	      <dependency>
	        <groupId>org.apache.maven.surefire</groupId>
	        <artifactId>surefire-junit47</artifactId>
	        <version>2.12</version>
	      </dependency>
	    </dependencies>
 	  </plugin>
  	</plugins>
  </build>