maven编译maven-surefire-plugin插件报错

 

1、编译错误信息:

60 [INFO] ------------------------------------------------------------------------
61 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project wbsbPubFunc: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
62 [ERROR] ----------
63 [ERROR] 1) org.apache.maven.surefire:surefire-junit4:jar:2.12.4
64 [ERROR] 
65 [ERROR] Try downloading the file manually from the project website.
66 [ERROR] 
67 [ERROR] Then, install it using the command:
68 [ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit4 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file
69 [ERROR] 
70 [ERROR] Alternatively, if you host your own repository you can deploy the file there:
71 [ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit4 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
72 [ERROR] 
73 [ERROR] Path to dependency:
74 [ERROR] 1) dummy:dummy:jar:1.0
75 [ERROR] 2) org.apache.maven.surefire:surefire-junit4:jar:2.12.4
76 [ERROR] 
77 [ERROR] ----------
78 [ERROR] 1 required artifact is missing.
79 [ERROR] 
80 [ERROR] for artifact:
81 [ERROR] dummy:dummy:jar:1.0
82 [ERROR] 
83 [ERROR] from the specified remote repositories:
84 [ERROR] alimaven (http://maven.aliyun.com/nexus/content/groups/public/, releases=true, snapshots=false)
85 [ERROR] -> [Help 1]
86 [ERROR] 
87 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
88 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
89 [ERROR] 
90 [ERROR] For more information about the errors and possible solutions, please read the following articles:
91 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
92 [ERROR] 
93 [ERROR] After correcting the problems, you can resume the build with the command
94 [ERROR]   mvn <goals> -rf :PubFunc

解决办法:

在pom.xml中加过滤条件

1           <plugin>
2                   <artifactId>maven-surefire-plugin</artifactId>
3                   <version>2.12.4</version>
4                  <configuration>
5                     <skipTests>true</skipTests>
6                 </configuration>
7                 </plugin>

 

2、jre版本不对,错误信息:

1 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wbsbAppIntf: Compilation failure
2 [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
3 [ERROR] -> [Help 1]
4 [ERROR] 
5 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
6 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
7 [ERROR] 

解决办法:把项目的jre配置改成自己本地的,不用默认设置的jre

 具体可以看这篇:

https://www.cnblogs.com/qyf404/p/5013694.html

posted @ 2019-02-18 11:33  柠檬味的橘子皮  阅读(18050)  评论(1编辑  收藏  举报