Maven在IntelliJ IDEA中的学习笔记(2)-----配置maven私服

来源:互联网 发布:opengl编程指南 第9版 编辑:程序博客网 时间:2024/06/07 06:08

1 Nexus 

简言之:maven 仓库管理器

这次的配置是在ubuntu:14.04上完成的


step A : 

下载安装 cd /opt/nexus 

wget  http://download.sonatype.com/nexus/oss/nexus-2.10.0-02-bundle.tar.gz 

ps:wget 是wget是一个下载文件的工具

step B :

解压安装包,配置启动权限,并启动

tar -zxvf nexus-2.10.0-02-bundle.tar.gz

cd /opt/nexus-2.10.0-02/bin

vim nexus

加上RUN_AS_USER=root  ,否则将没有权限启动

启动: ./nexus start  

step C

用 “服务器:8081/nexus” 进行访问,登录:admin/admin123 

step D

配置并上传 ,这部分参考了这篇文章:点击打开链接 将自己的jar包上传到第三方的仓库中,

在以后使用中,找到这个jar包,然后用nexus提供的xml文件,添加到IDEA的pom.xml 文件的依赖元素下,开发环境将为我们自动下载,这个jar

step E :

这是需要做如下配置来让IDEA中maven插件找到我们自己的maven私服

首先需要:在repositories元素下,添加我们的私服地址:

  <repository>                <id>nexus</id>                <name>Central Repository</name>                <url>http://192.168.1.196:8081/nexus/content/groups/public</url>                <releases>                    <enabled>true</enabled>                </releases>                <snapshots>                    <enabled>false</enabled><!---->                </snapshots>              </repository>

然后千万不要忘记:在settings元素下面,将刚才的配置激活,否则无法使用我们的私服
    <activeProfiles>        <activeProfile>nexus</activeProfile>    </activeProfiles>



0 0
原创粉丝点击