1. 程式人生 > >Maven打包自動釋出到nexus私服

Maven打包自動釋出到nexus私服

通過命令 -f指定的pom檔案 deploy打包釋出

Intellij Idea中可以通過Run-EditConfigurations-"+"-Maven新建一個自定義maven指令碼,將剛才的釋出命令填入Command line中儲存即可

先設定pom檔案裡的build資訊,可以是maven-compiler-plugin外掛

maven目錄conf的setting.xml裡:

</servers>  
 <server>  
    <id>releases</id>  
    <username>admin</username>  
    <password>admin123</password>  
  </server>  
 <server>  
  <id>snapshots</id>  
  <username>admin</username>  
  <password>admin123</password>  
  </server>  
</servers>  

pom檔案新增如下,這裡的id上面的id要對應,name無所謂

<!-- 配置遠端釋出到私服,mvn deploy -->  
<distributionManagement>  
    <repository>  
        <id>releases</id>  
        <name>Nexus Release Repository</name>  
        <url>http://10.1.81.199:8081/nexus/content/repositories/releases/</url>  
    </repository>  
    <snapshotRepository>  
        <id>snapshots</id>  
        <name>Nexus Snapshot Repository</name>  
        <url>http://10.1.81.199:8081/nexus/content/repositories/snapshots/</url>  
    </snapshotRepository>  
</distributionManagement>  

沒有許可權去管理介面檢視DeploymentPolicy設定為Allow Redeploy

admin密碼預設admin123deployment密碼預設deployment123