首页 > 其他 > 详细

使用MAVEN请注意,MAVEN不支持最新版jdk1.7

时间:2014-03-07 04:03:55      阅读:762      评论:0      收藏:0      [点我收藏+]
MAVEN官网最新版本的系统要求

System Requirements

JDK Maven 3.2 requires JDK 1.6 or above, while Maven 3.0/3.1 requires JDK 1.5 or above (this is to execute Maven - it still allows you to build against 1.3 and prior JDK‘s)
Memory No minimum requirement
Disk No minimum requirement. Approximately 100MB will be used for your local repository, however this will vary depending on usage and can be removed and redownloaded at any time.
Operating System No minimum requirement. On Windows, Windows NT and above or Cygwin is required for the startup scripts. Tested on Windows XP, Fedora Core and Mac OS X.


系统要求jdk1.6或以上,但是我最近电脑重装系统之后,不想安装太多版本jdk,所以就安装了1.7的最新版。

没想到使用MAVEN的时候,总是无法下载插件,无法联网,就算增加源也解决不了问题,很费解。在Google上查询结果后也没有找到解决办法。


MAVEN错误信息如下:

Downloading: http://maven.oschina.net/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom
三月 06, 2014 8:40:45 下午 org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
信息: I/O exception (java.net.SocketException) caught when processing request: Connection reset
三月 06, 2014 8:40:45 下午 org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
信息: Retrying request
三月 06, 2014 8:41:27 下午 org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
信息: I/O exception (java.net.SocketException) caught when processing request: Connection reset
三月 06, 2014 8:41:27 下午 org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
信息: Retrying request
三月 06, 2014 8:42:09 下午 org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
信息: I/O exception (java.net.SocketException) caught when processing request: Connection reset
三月 06, 2014 8:42:09 下午 org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute
信息: Retrying request


[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.ap
ache.maven.plugins:maven-install-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-install-plugin:pom:2.4 from/to nexus-osc (http://maven.oschina.net/content/groups/public/): Connection reset -> [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


从错误信息来看,只能从java.net.SocketException入手,因为我其他电脑上的jdk都是1.6,1.7同时存在,而且JAVA_HOME都配置的1.6,所以觉得可能是这方面的问题。

没有换JDK之前:

D:\Git>mvn -v
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T01:37:52+08:00)
Maven home: C:\Program Files\apache-maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_45\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"


换了JDK之后:

D:\Git>mvn -v
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T01:37:52+08:00)
Maven home: C:\Program Files\apache-maven
Java version: 1.6.0_43, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_43\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"


再之后,运行MAVEN就没有问题了。


如果有人遇到类似的问题,可以换个低版本的JDK试试。我电脑安装的都是64位版本,32位没有测试是否有问题。


使用IDEA或Eclipse的还需要在IDE中对MAVEN的jdk进行修改。已知IDEA需要修改两处。Eclipse暂时没试,估计不用改。


解决问题的方法确实简单,不过由于过于相信MAVEN官方说明,因而没考虑到JDK版本的问题,实在是浪费时间。

使用MAVEN请注意,MAVEN不支持最新版jdk1.7,布布扣,bubuko.com

使用MAVEN请注意,MAVEN不支持最新版jdk1.7

原文:http://blog.csdn.net/isea533/article/details/20651033

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!