在Mac平台安裝Maven3

编程技术  /  houtizong 发布于 3年前   81

在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/ 。


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

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客