maven 打包test报错

报错内容

Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://uk.maven.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update interval of UK has elapsed or updates are forced. 
Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to UK (http://uk.maven.org/maven2): 
The operation was cancelled.

解决方法
这里应该是没有加入surefire-plugin依赖导致的问题,直接在pom.xml中加入依赖,update project即可

具体:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-surefire-plugin</artifactId>
   <configuration>
      <skipTests>true</skipTests>
   </configuration>
</plugin>

同时记录一下跳过编译test的方法:

1、mvn clean install -DskipTests

2、mvn clean install -Dmaven.test.skip=true

或者

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-surefire-plugin</artifactId>
   <configuration>
      <skipTests>true</skipTests>
   </configuration>
</plugin>

你可能感兴趣的:(maven)