Maven & Nexus install in Linux (Maven Nexus 安装)

[size=medium]Maven安装[/size]

1. 下载maven
http://www.apache.org/dyn/closer.cgi/maven/binaries
2. 加压下载文件到/local/maven
tar -zxvf apache-maven-2.2.1-bin.tar.gz
3. 编辑/etc/profile.d/maven.sh,如果没有需要增加maven.sh文件,并添加代码
MAVEN_HOME=/usr/local/apache-maven-3.0.3
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
4. 在命令行输入下面的命令能看到maven的版本信息说明Maven安装成功
mvn -v

[size=medium]Nexus安装[/size]
1. 下载Nexus包
http://m2eclipse.sonatype.org/nexus/archived
2. cp nexus-2.2.bundle.tar.gz /lcoal/nexus
3. 到/local/nexus目录下tar -zxvf nexus-2.2-bundle.tar.gz解压
4. 选择目录到JSW对应的系统版本下,如/local/nexus/nexus-2.2-01/bin/jsw/linux-x86-32执行 ./nexus stat启动nexus服务器
5. 验证服务启动,在网页中输入http://localhost:8081/nexus/能够看到服务器页面
6. login nexus服务器的默认用户名、密码是admin, admin123

注意: 1. 也可以直接把war包丢到tomcat下部署nexus服务器
2. 如果执行启动命令后nexus服务器并没有起来,可以到/local/nexus/nexus-2.2-01/logs目录中查看日志文件查明原因。
3. 如果报version 51之类的错误,可能你的java版本不匹配当前的nexus服务器,可以选择下载匹配的nexus包,当前nexus2.2用的是JDK6
4. 如果nexus不能下载jar包,需要做一下检查。
首先到server中配置代理,确保代理是可用的,如果代理是需要认证的,也需要输入用户名和密码。
然后到Routing中将需要用的Repository从Available Repositories加到左边的Ordered Route Configuration中。
之后回到Repositories在Public Repositories中将Available Repositories中用到的Repository加到Ordered Group Repositories中。
其次,还需要到相应的Repostory中配置代理,同样如果需要认证,输入相应的用户名和密码及域名。并把Download remote indexex设置为True。
最后,点击每个Repostory,右键选择Allow proxy,然后选择Update Index。
这时,查看remote index应该有内容了。如果Repository是正常的,他的status应该是In Service,如果状态显示In Service - Remote Automatically Blocked,表明当前的服务不可用,有问题。

非常好的参考资料,讲得很细
http://blog.csdn.net/arvinzhuo/article/details/4244061


[size=medium]加Nexus到Maven[/size]
修改maven的conf/settings.xml,增加下面的内容
第一部分:
<server>
<id>nexus-release</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>

第二部分:

<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://127.0.0.1:8081/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
第三部分:

<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>


[size=medium]测试mvn和Nexus:[/size]
运行 mvn help:system 会下载很多相关的包,配置完成

[size=medium]M2E install(安装M2E到Eclipse):[/size]
eclipse中安装Maven的插件需要通过eclipse的MarketPlace,或者是Install new software。但是并不推荐使用Install new software,因为网上大部分链接是不可用的,除非你找到最新的链接。
如果使用MarketPlace,在查找中输入m2e,然后在查找结果中安装就行,非常方便。
注意: 如果报告各种错误,基本都是因为代理设置有问题。解决方法是在window -> Preferences -> Network Connections -> Manual 中设置Http和Https的代理,把SOCKS的代理去掉,不选。然后重新启动eclipse,进入MarketPlace就可以了。
如果安装过程报错,比如slf4j错误之类的,说明你需要先安装这些包,可以查询一下包的地址,然后在Install New Software中安装它,比如Name : slf4j URL: http://www.fuin.org/p2-repository/ 。安装完后再选中M2E进行安装Maven插件就可以了。
如果遇到org.eclipse.wst.sse.core.0.0.0 错误,首先添加Helios site到new software, URL输入http://download.eclipse.org/releases/helios ,然后在安装new software中把Maven和Helios都选中,即默认这两项都同时安装,安装即可,如果遇到警告信息,点确认就行,不必关心。


[size=large][b]Maven catalog 丢失[/b][/size]

http://blog.csdn.net/afgasdg/article/details/12757433
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值