Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test ,default-test on project sharp-common: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin

 1 [INFO] Scanning for projects...
 2 [INFO] 
 3 [INFO] -----------------------< com.sharp:sharp-common >-----------------------
 4 [INFO] Building sharp-common 0.0.1-SNAPSHOT
 5 [INFO] --------------------------------[ jar ]---------------------------------
 6 [INFO] 
 7 [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ sharp-common ---
 8 [INFO] Deleting G:\worksheet\sharp-common\target
 9 [INFO] 
10 [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ sharp-common ---
11 [INFO] Using 'UTF-8' encoding to copy filtered resources.
12 [INFO] Copying 1 resource
13 [INFO] Copying 0 resource
14 [INFO] 
15 [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ sharp-common ---
16 [INFO] Changes detected - recompiling the module!
17 [INFO] Compiling 1 source file to G:\worksheet\sharp-common\target\classes
18 [INFO] 
19 [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ sharp-common ---
20 [INFO] Using 'UTF-8' encoding to copy filtered resources.
21 [INFO] skip non existing resourceDirectory G:\worksheet\sharp-common\src\test\resources
22 [INFO] 
23 [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ sharp-common ---
24 [INFO] Changes detected - recompiling the module!
25 [INFO] Compiling 1 source file to G:\worksheet\sharp-common\target\test-classes
26 [INFO] 
27 [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ sharp-common ---
28 [WARNING] The POM for org.apache.maven.reporting:maven-reporting-api:jar:3.0 is missing, no dependency information available
29 [INFO] ------------------------------------------------------------------------
30 [INFO] BUILD FAILURE
31 [INFO] ------------------------------------------------------------------------
32 [INFO] Total time: 1.759 s
33 [INFO] Finished at: 2018-11-27T17:50:15+08:00
34 [INFO] ------------------------------------------------------------------------
35 [WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
36 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project sharp-common: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.22.1 -> org.apache.maven.surefire:maven-surefire-common:jar:2.22.1 -> org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.5.2: Failed to read artifact descriptor for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.5.2: Failure to find org.apache.maven.plugin-tools:maven-plugin-tools:pom:3.5.2 in http://192.168.135.128:8081/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of my-nenux has elapsed or updates are forced -> [Help 1]
37 [ERROR] 
38 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
39 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
40 [ERROR] 
41 [ERROR] For more information about the errors and possible solutions, please read the following articles:
42 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

修改前pom

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 4     <modelVersion>4.0.0</modelVersion>
 5 
 6     <parent>
 7         <groupId>com.sharp</groupId>
 8         <artifactId>sharp-pom</artifactId>
 9         <version>0.0.1-SNAPSHOT</version>
10     </parent>
11     <artifactId>sharp-common</artifactId>
12     <packaging>jar</packaging>
13 
14     <name>sharp-common</name>
15     <description>公共模块</description>
16 
17 
18     <dependencies>
19      <dependency>
20          <groupId>org.springframework.boot</groupId>
21          <artifactId>spring-boot-starter</artifactId>
22       </dependency>
23  
24       <dependency>
25          <groupId>org.springframework.boot</groupId>
26          <artifactId>spring-boot-starter-test</artifactId>
27          <scope>test</scope>
28       </dependency>
29     </dependencies>
30      <build>
31       <plugins>
32          <plugin>
33             <groupId>org.springframework.boot</groupId>
34             <artifactId>spring-boot-maven-plugin</artifactId>
35          </plugin>
36       </plugins>
37    </build>
38     <distributionManagement>
39         <repository>
40             <id>my-release</id>
41             <url>http://xxxxxx:8081/repository/maven-releases/</url>
42         </repository>
43         <snapshotRepository>
44             <id>my-snapshots</id>
45             <url>http://xxxxxxx:8081/repository/maven-snapshots/</url>
46         </snapshotRepository>
47     </distributionManagement>
48 </project>

添加如下代码:<version>2.6</version> 信息缺失就会上述错误要注意

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<version>2.6</version>

<configuration>

<skipTests>true</skipTests>

</configuration>

</plugin>

变为

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 3     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 4     <modelVersion>4.0.0</modelVersion>
 5 
 6     <parent>
 7         <groupId>com.sharp</groupId>
 8         <artifactId>sharp-pom</artifactId>
 9         <version>0.0.1-SNAPSHOT</version>
10     </parent>
11     <artifactId>sharp-common</artifactId>
12     <packaging>jar</packaging>
13 
14     <name>sharp-common</name>
15     <description>公共模块</description>
16 
17 
18     <dependencies>
19      <dependency>
20          <groupId>org.springframework.boot</groupId>
21          <artifactId>spring-boot-starter</artifactId>
22       </dependency>
23  
24       <dependency>
25          <groupId>org.springframework.boot</groupId>
26          <artifactId>spring-boot-starter-test</artifactId>
27          <scope>test</scope>
28       </dependency>
29     </dependencies>
30      <build>
31       <plugins>
32          <plugin>
33             <groupId>org.springframework.boot</groupId>
34             <artifactId>spring-boot-maven-plugin</artifactId>
35          </plugin>
36          <plugin> 
37             <groupId>org.apache.maven.plugins</groupId> 
38             <artifactId>maven-surefire-plugin</artifactId> 
39             <version>2.6</version>    
40             <configuration>    
41             <skipTests>true</skipTests>    
42             </configuration> 
43             </plugin>
44       </plugins>
45    </build>
46     <distributionManagement>
47         <repository>
48             <id>my-release</id>
49             <url>http://192.168.135.128:8081/repository/maven-releases/</url>
50         </repository>
51         <snapshotRepository>
52             <id>my-snapshots</id>
53             <url>http://192.168.135.128:8081/repository/maven-snapshots/</url>
54         </snapshotRepository>
55     </distributionManagement>
56 </project>

然后再次 clean install/deploy成功