Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)

时间:2022-07-07 17:14:21

1. 跟着《Maven实战》练习时,编译第一个Maven项目Hello World编译报错了,错误如下:
<span style="white-space:pre">	</span>环境:Intellij IDEA 13.1.4 + Maven 3.2.3
Unavailable. for http://maven.oschina.net/content/groups/public/junit/junit/3.8.2/junit-3.8.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:20 min
[INFO] Finished at: 2014-12-11T17:17:47+08:00
[INFO] Final Memory: 6M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project hello-world: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile failed: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 -> org.codehaus.plexus:plexus-container-default:jar:1.5.5 -> org.apache.xbean:xbean-reflect:jar:3.4: Failed to read artifact descriptor for org.apache.xbean:xbean-reflect:jar:3.4: Could not transfer artifact org.apache.xbean:xbean-reflect:pom:3.4 from/to osc (http://maven.oschina.net/content/groups/public/): Failed to transfer file: http://maven.oschina.net/content/gr
oups/public/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.pom. Return code is: 503 , ReasonPhrase:Service Unavailable. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

2. 找到这篇帖子( 点击打开链接), 把eclipse的jre目录改成jdk 的。由于用的是IDEA,只好在设置里面搜了下,找到了下面这个页面的项,设置一下就好了。

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)


把默认的Internal JRE改成了JAVA_HOME。


3. 运行后成功了,截图如下:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)