搭建项目上传至nexus下拉验证是否成功

注意点: 1、你打的包是jar包还是pom,还是war包 2、上传 需在代码中配置,但是下拉就不需要。必须优化。

上传的时候需要在父pom中配

<distributionManagement>
        <!--Release类型的托管资源库-->
        <repository>
            <!--id对应nexus仓库的id-->
            <id>test_hosted</id>
            <!--自定义名称-->
            <name>Releases</name>
            <!--仓库对应的URL地址-->
            <url>http://192.168.61.220:8089/repository/test_hosted/</url>
        </repository>
        <!--Snapshot类型的托管资源库-->
        <snapshotRepository>
            <!--id对应nexus仓库的id-->
            <id>test_snapshot_hosted</id>
            <!--自定义名称-->
            <name>Snapshot</name>
            <!--仓库对应的URL地址-->
            <url>http://192.168.61.220:8089/repository/test_snapshot_hosted/</url>
        </snapshotRepository>
    </distributionManagement>

改setting文件

<?xml version="1.0" encoding="UTF-8"?>

<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0">

<!-- 本地仓库地址 -->
<localRepository>D:workSoftwareJavamaven
epository</localRepository>

<!--nexus服务器,id自定义,用户名和密码为nexus服务器的账号密码-->
  <servers>  
  <!--id为对应资源库id-->  
    <server>  
        <id>test_snapshot_hosted</id>  
        <username>admin</username>  
        <password>admin</password>  
    </server>
    <server>  
        <id>test_hosted</id>  
        <username>admin</username>  
        <password>admin</password>  
    </server>  
    <server>  
        <id>nexus</id>  
        <username>admin</username>  
        <password>admin</password>  
    </server>   
  </servers>  
  <!--组资源库的url地址  id和name自定义,mirrorOf的值设置为central,写死的-->  
  <mirrors>     
    <mirror>  
        <id>nexus</id>  
        <name>nexus repository</name>  
        <url>http://192.168.61.220:8089/repository/test_group/</url>  
        <mirrorOf>central</mirrorOf>  
    </mirror>     
  </mirrors>  

</settings>

如何实现自动化,如何上传的时候不用在父pom中配置,敬请期待吧~

经验分享 程序员 微信小程序 职场和发展