CI系列之四:Maven私服Nexus安装及配置

一、Linux安装和配置Mavne Nexus

nexus的运行依赖于JDK,安装JDK,可以参照博客(CI系列之一:JDK安装及配置)

1.安装

1.1.sftp上传文件:nexus-2.14.8-01-unix.tar.gz,具体上传过程可以参照博客(CI系列之一:JDK安装及配置)

1.2.移动nexus-2.14.8-01-unix.tar.gz至安装目录

# mv nexus-2.14.8-01-unix.tar.gz /usr/local

1.3.切换到安装目录

# cd /usr/local 

1.4.解压tar.gz

# tar -zxvf nexus-2.14.8-01-unix.tar.gz

1.5.切换到执行文件所在目录,

# cd /usr/local/nexus-2.14.8-01/bin

1.6.编辑执行文件nexus,为了使能够以root用于运行,修改的内容如下:

# vi nexus
RUN_AS_USER=root

1.7.启动Maven Nexus

# ./nexus start

1.8.浏览器访问nexus服务,用户名和密码admin/admin123

扫描二维码关注公众号,回复: 157943 查看本文章

http://192.168.2.134:8081/nexus/

2.Central配置之重构索引

2.1.Views/Repositories Repositories 配置 Central,Configuration下Download Remote Indexs设为true

2.2.点击save按钮之后,就可以在Administration -> Scheduled Tasks查看重构索引的任务执行情况,时间比较长。

3.Views/Repositories -> Repositories 配置 3rd party,添加第三方类库

3.1.Artifact Upload界面,添加第三方类库

3.1.1.GAV Definition选中GAV Parameters

3.1.2.点击Select Artifact(s) to Upload按钮,选择上传的jar包文件

3.1.3.点击Add Artifact按钮

3.1.4.修改group名称

3.1.5.Upload Artifact(s)

3.2.Browse Index 界面,Refresh按钮点击之后,可在下方的菜单栏中找到已添加的jar包,并看到完整的jar依赖

二、Windos配置Maven:settings.xml,以下是新增的内容

#配置id为nexus的profile
<profile>
    <id>nexus</id>
    <repositories>
        <repository>
            <id>public</id>
            <name>Local Public Repository</name>
            <url>http://192.168.2.132:8081/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>public</id>
            <name>Local Public Repository</name>
            <url>http://192.168.2.132:8081/nexus/content/groups/public/</url>
        </pluginRepository>
    </pluginRepositories>
</profile>
#激活nexus
<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>

猜你喜欢

转载自blog.csdn.net/jian_j_z/article/details/80220053