使用Nexus上传jar包

nexus将本地文件推送到nexus中心库
在本地搭建的nexus服务中,找到releases和snapshots这两个库对应的URL

http://localhost:8082/repository/maven-releases/  
http://localhost:8082/repository/maven-snapshots/ 

maven,找到settingxml 配置文件

<servers>  
      ...  
      <server>  
            <id>maven-releases</id>  
            <username>admin nexus用户名</username>  
            <password>admin123 nexus密码</password>  
      </server>  
      <server>  
            <id>maven-snapshots</id>  
            <username>admin</username>  
            <password>admin123</password>  
      </server>  
      ...  
</servers>

在项目pom.xml文件中,做如下配置:

<distributionManagement>  
      <repository>  
        <id>maven-releases</id>  
        <url>http://localhost:8082/repository/maven-releases/</url>  
      </repository>  
      <snapshotRepository>  
        <id>maven-snapshots</id>  
        <url>http://localhost:8082/repository/maven-snapshots/</url>  
      </snapshotRepository>  
    </distributionManagement>


注意层级
回到该项目文件的根目录先后执行 mvn clean install / mvn clean deploy

看到
Uploaded to maven-snapshots即为成功

打开nexus仓库页面可以看到上传的文件

还可以手动上传
maven私服nexus上传第三方jar包以及下载

原文地址:https://www.cnblogs.com/sjj33sda/p/14118654.html