Linux搭建nexus私人仓库,并上传下载maven jar

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013219624/article/details/84960836

1.nexus私人仓库安装启动

# 下载nexus
https://download.sonatype.com/nexus/oss/nexus-2.14.10-01-bundle.tar.gz

tar -zvxf nexus-2.14.10-01-bundle.tar.gz

# 修改RUN_AS_USER
vim bin/nexus
RUN_AS_USER=root     
         
# 启动nexus
./bin/nexus start 

# 访问
http://172.22.2.133:8081/nexus/
用户名: admin 密码: admin123

2.上传maven jar

# 本地maven配置
<server>
    <id>releases</id>
    <username>admin</username>
    <password>admin123</password>
</server>
<server>
    <id>snapshots</id>
    <username>admin</username>
    <password>admin123</password>
</server>

# maven源码pom.xml文件添加配置
<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://172.22.2.133:8081/nexus/content/repositories/releases/</url>
    </repository>

    <snapshotRepository>
        <id>snapshots</id>
        <url>http://172.22.2.133:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>

# 上传
mvn deploy

3.下载Maven jar

# 本地Maven配置
<profiles>   
    <profile>   
        <id>activeProfile</id>   
        <repositories>   
            <repository>  
                <id>public</id>   
                <url>http://172.22.2.133:8081/nexus/content/groups/public/</url>   
                <releases>   
                    <enabled>true</enabled>   
                </releases>
                <snapshots>   
                    <enabled>true</enabled>   
                </snapshots>   
            </repository>   
        </repositories>  
        <pluginRepositories>  
            <pluginRepository>  
                <id>public</id>  
                <url>http://172.22.2.133:8081/nexus/content/groups/public/</url>  
            </pluginRepository>  
        </pluginRepositories>  
    </profile>  
</profiles>

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

猜你喜欢

转载自blog.csdn.net/u013219624/article/details/84960836