使Maven 2在package、install等阶段跳过运行Test的配置

来源:互联网 发布:手机创业软件 编辑:程序博客网 时间:2024/05/18 02:54

Skipping Tests 

To skip running the tests for a particular project, set the skipTests property to true. 

Xml代码  收藏代码
  1. <project>  
  2.   [...]  
  3.   <build>  
  4.     <plugins>  
  5.       <plugin>  
  6.         <groupId>org.apache.maven.plugins</groupId>  
  7.         <artifactId>maven-surefire-plugin</artifactId>  
  8.         <version>2.4.2</version>  
  9.         <configuration>  
  10.           <skipTests>true</skipTests>  
  11.         </configuration>  
  12.       </plugin>  
  13.     </plugins>  
  14.   </build>  
  15.   [...]  
  16. </project>  


You can also skip the tests via command line by executing the following command: 

mvn install -DskipTests 

If you absolutely must, you can also use the maven.test.skip property to skip compiling the tests. maven.test.skip is honored by Surefire and the Compiler Plugin. 

mvn install -Dmaven.test.skip=true

转载:http://mysun.iteye.com/blog/403502

原创粉丝点击