2012-10-05 25 views
7

我很新的Maven ...我可以修改Maven部署階段以使用我自己的插件來替換maven-deploy-plugin嗎?

我想要做的是在部署階段跳過maven-deploy-plugin,而用自己的插件替換它(即我正在部署到一個非存儲庫位置)。

我知道我可以在多種其他方式做到這一點,但老闆要能夠運行:

MVN部署

爲了讓我當前的解決方法,這是結果禁用maven-deploy-plugin(這似乎是禁用整個部署階段),並從命令行手動指定自定義上傳目標。

我目前沒有在我的使命與成功:

<executions> 
    <execution> 
     <phase>deploy</phase> 
    </execution> 
</executions> 
在build /插件/插件包含我的插件規範部分

,因爲部署階段被跳過:

 <plugin> 
      <artifactId>maven-deploy-plugin</artifactId> 
      <version>2.7</version> 
      <configuration> 
       <skip>true</skip> 
      </configuration> 
     </plugin> 

謝謝!

回答

6

嘗試此(未測試的)替代用於禁用標準部署插件:

<plugin> 
    <artifactId>maven-deploy-plugin</artifactId> 
    <version>2.7</version> 
    <executions> 
     <execution> 
      <id>default-deploy</id> 
      <phase>none</phase> 
     </execution> 
    </executions> 
</plugin> 
+1

這將一直工作到'maven-deploy-plugin' ,與'default-deploy'不同' – yegor256

+0

這個工作原理很有用,如果你想用eg替換標準的部署行爲一個特定的部署文件執行。 –

+1

@ yegor256我同意。儘管我會認爲在慎重轉移到新版Maven的過程中會很快恢復。 –

9

禁用行家 - 部署 - 插件(這似乎是禁用整個部署階段)

這是不正確的。禁用maven-deploy-plugin不會禁用整個部署階段。這是它應該如何完成的(看起來像你已經這樣做了):

<build> 
    <pluginManagement> 
    <plugins> 
     <plugin> 
     <artifactId>maven-deploy-plugin</artifactId> 
     <configuration> 
      <skip>true</skip> 
     </configuration> 
     </plugin> 
    </plugins> 
    </pluginManagement> 
</build> 
+0

是的 - 你是對的。我想通了 - 見下文。感謝您的輸入! – jbeck

相關問題