在Mac平台安裝Maven3

在Mac平台安裝Maven


如果有安裝XCode, XCode会自动帮你安裝Maven, 安裝在/usr/share/java/


安裝3.0.3

到http://maven.apache.org/download.html下載maven 3.0.3

将apache-maven-3.0.3-bin.tar.gz解压缩到/usr/share/java

移除/usr/share下的softlink maven

ln -s /usr/share/java/apache-maven-3.0.3 /usr/share/maven

修改~/.profile 设定M3_HOME=/usr/share/java/apache-maven-3.0.3

注意事项


不能同时设M2_HOME与M3_HOME两个环境变量, 不然执行maven会出现以下的exception

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/codehaus/plexus/classworlds/launcher/Launcher  Caused by: 
java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher   at 
java.net.URLClassLoader$1.run(URLClassLoader.java:202)   at 
java.security.AccessController.doPrivileged(Native Method)   at 
java.net.URLClassLoader.findClass(URLClassLoader.java:190)   at 
java.lang.ClassLoader.loadClass(ClassLoader.java:307)   at 
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)   at 
java.lang.ClassLoader.loadClass(ClassLoader.java:248)

 


参考:http://cb.esast.com/cb/wiki/22945

Installing Maven 3 on OS X


1. Install Mac Ports

2. Install Maven 3


Open a terminal and type the following:


sudo port install maven3 maven_select

sudo maven_select maven3



------------------------------------------------------------------------

使用MAVEN构造springside-4.0失败、异常


信息如下:

 

xxxx@localhost springside-4.0.0.RC3$ mvn install

[INFO] Scanning for projects...

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Build Order:

[INFO] 

[INFO] Springside :: Project

[INFO] Springside :: Module :: Core

[INFO] Springside :: Module :: Extension

[INFO] Springside :: Example :: Mini-Service

[INFO] Springside :: Example :: Mini-Web

[INFO] Springside :: Example :: Showcase

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building Springside :: Project 4.0.0.RC3

[INFO] ------------------------------------------------------------------------

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO] 

[INFO] Springside :: Project ............................. FAILURE [1:15.947s]

[INFO] Springside :: Module :: Core ...................... SKIPPED

[INFO] Springside :: Module :: Extension ................. SKIPPED

[INFO] Springside :: Example :: Mini-Service ............. SKIPPED

[INFO] Springside :: Example :: Mini-Web ................. SKIPPED

[INFO] Springside :: Example :: Showcase ................. SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1:16.465s

[INFO] Finished at: Sun Jul 08 16:31:26 CST 2012

[INFO] Final Memory: 3M/81M

[INFO] ------------------------------------------------------------------------

[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1: Could not transfer artifact org.apache.maven.plugins:maven-install-plugin:pom:2.3.1 from/to central (http://repo1.maven.org/maven2): Error transferring file: Operation timed out -> [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




原因:

发现无法访问中央库http://repo1.maven.org/maven2/ 。


解决:过了两天就能访问了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值