win7 + maven + nexus + Eclipse
2014-02-16 15:35
621 查看
1.软件安装
1.1、maven下载安装
apache-maven-3.0-bin.tar.gz下载地址:http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-3.0-bin.tar.gz解压,配置环境变量M2_HOME(解压根目录),PATH(bin目录)
1.2、nexus下载安装
nexus-2.7.0-bundle.tar.gz下载地址:http://nexus.sonatype.org/downloads/1.2.1 解压并执行
解压后进入nexus-2.7.0-bundle\nexus-2.7.0-06\bin\jsw,根据操作系统类型选择文件夹,我选的是windows-x86-64文件夹bat文件。1.2.2 运行Nexus
在浏览器中输入:http://localhost:8081/nexus就可以看到nexus 的主页,点击右上角Log in
默认用户名和密码是:admin/admin123
运行后会自动生成一个nexus工作目录sonatype-work,nexus下载的jar包会存放在
sonatype-work/nexus/storage中
1.2.3 配置
点击左侧菜单Repositories分别将右侧列表中
1)Apache Snapshots
2)Codehaus Snapshots
3)Maven Central
三个repository 的configuration配置选项中的Download Remote Index 配置改为True,并保存设置,
然后在列表中分别右键点击三个Repository,点击ReIndex 。true是开启,false是关闭 由于中央仓库内容比较多,因此其索引文件比较大,需要查看下载是否完成了,我们可以单击界面左边导航栏中的 Scheduled Tasks 链接后,就可以看到系统调度的任务其状态为 runing,在说哦因下载完毕之后,该任务就会消失。
2.配置settings.xml
2.1配置本地仓库
<localRepository>D:/work/software/maven/java</localRepository>2.2在mirrors中添加
<mirror><id>nexus</id>
<mirrorOf>*</mirrorOf>
<name>Nexus Mirror</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
2.3在profiles(此处是全局配置)中添加
<profile><id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
注:
3.出错处理
3.1 resolution will not be reattempted until the update interval of nexus h
添加更新既可以<updatePolicy>always</updatePolicy>,如下所示<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
4.Eclipse配置
4.1 安装maven插件
Eclipse EE版本自带此插件,没有带自己下载4.2 settings.xml文件
windows-->preferences-->Maven-->User Settings 选择刚才maven-->conf-->settings.xml(2配置的xml文件)4.3 配置外置maven
windows-->preferences-->Maven-->Installations 选择1下载maven相关文章推荐
- Apriori算法实例----Weka,R, Using Weka in my javacode
- Myeclipse中java项目转成Web项目
- spring,mybatis事务管理配置与@Transactional注解使用
- Java身份证验证工具类
- Eclipse Debug模式的开启与关闭
- JAVA基础加强之枚举
- java类加载器
- java传智播客入学题目总结
- JAVA OOP 基础知识提纲
- Java 默认修饰符 总结
- java并发编程学习总结(基础篇)
- java post数据服务器拒绝的解决方法
- java String类(字符串)的方法
- java 类的加载,与获得相应的方法
- java打印当前方法名示例分享
- Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(五)
- Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(四)
- Java Generics 特例
- java回调函数的应用,andriod简单2d动画显示!
- Java学习之提高!初步接触eclipse和知识复苏(因为有不少是前面提到的)