settings.xml

<server>
  <id>nexus-releases</id>
  <username>admin</username>
  <password>你的密码</password>
</server>
<server>
  <id>nexus-snapshots</id>
  <username>admin</username>
  <password>你的密码</password>
</server>

<repositories>
    <repository>
        <id>nexus</id>
        <name>Nexus Repository</name>
        <url>http://172.16.3.100:8081/repository/maven-public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>nexus</id>
        <name>Nexus Plugin Repository</name>
        <url>http://172.16.3.100:8081/repository/maven-public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>

配置上传jar包项目的pom.xml

<distributionManagement>  
  <repository>  
    <id>nexus-releases</id>  
    <name>Nexus Release Repository</name>  
    <url>http://172.16.3.100:8081/repository/maven-releases/</url>  
  </repository>  
  <snapshotRepository>  
    <id>nexus-snapshots</id>  
    <name>Nexus Snapshot Repository</name>  
    <url>http://172.16.3.100:8081/repository/maven-snapshots/</url>  
  </snapshotRepository>  
</distributionManagement>

上传jar包到nexus

mvn deploy:deploy-file
  -DgroupId=坐标
  -DartifactId=坐标
  -Dversion=版本
  -Dpackaging=jar
  -Dfile=jar本地路径
  -Durl=http://172.16.3.100:8081/repository/3rdparty/
  -DrepositoryId=nexus-releases

docker启动nexus

cd /opt && mkdir nexus-data && chmod 200 nexus-data && chown nexus nexus-data
docker run -d -p 8081:8081 --name nexus --ulimit nofile=65536:65536 -v /opt/nexus-data:/nexus-data sonatype/nexus3:3.24.0

docker run -dti \
        --net=host \
        --name=nexus \
        --privileged=true \
        --restart=always \
        --ulimit nofile=65536:65536 \
        --ulimit memlock=-1 \
        --memory=16G \
        --memory-swap=-1 \
        --cpuset-cpus='1-7' \
        -e INSTALL4J_ADD_VM_PARAMS="-Xms4g -Xmx4g -XX:MaxDirectMemorySize=8g" \
        -v /etc/localtime:/etc/localtime \
        -v /data/nexus:/nexus-data \
        sonatype/nexus3:latest

标签: none

添加新评论