2011-10-20 42 views
2

我有一個maven多模塊項目。在一個模塊中,我們使用maven-assembly-plugin創建了2個ZIP文件。此配置爲:Maven發佈:使用程序集插件執行錯誤(多模塊項目)

<configuration> 
      <finalName>${sample.source.zip.filename}</finalName> 
      <appendAssemblyId>false</appendAssemblyId> 
      <outputDirectory>${project.build.directory}/zip</outputDirectory> 
      <descriptors>         
       <descriptor>src/main/assembly/sample-source.xml</descriptor> 
      </descriptors> 
     </configuration> 


at the war packaging, we put this 2 zip files into the war files, with the maven-war-plugin 

    ... 
    <resource> 
     <directory>${project.build.directory}/zip</directory> 
     <targetPath>client</targetPath> 
    </resource> 
    ... </code></pre> 

這是可以的。但在安裝階段,maven將這些壓縮文件「複製」到本地存儲庫中的相同文件名! (module_name & version_number & .zip)我不知道,爲什麼它重命名tha zip文件!? (在戰爭中需要zip文件,但不是在存儲庫中的單個文件中。)但是,如果maven想複製它到那裏,這對我來說可以,但爲什麼是重命名?

有任何想法嗎?有沒有什麼辦法在安裝時排除文件?這是一個非常大的問題,因爲在部署maven想要將具有相同名稱的zip文件上傳到maven存儲庫,但在第二個副本失敗。 (因爲有一個同名的zip文件....)

回答

3

它是standard behavior for the assembly plugin將它生成的程序集附加到項目中,以便它們將作爲項目的工件進行安裝和部署。如果存在命名衝突,那是因爲你沒有給出兩個程序集獨特的ID。 id of the assembly is used in constructing the final file name。這是解決程序集之間命名衝突的正確方法。

要停止將組件作爲工件附加到項目並因此阻止其安裝或部署,請設置attach = false, in the assembly plugin's configuration

+0

謝謝!完美的答案。 attach = false解決了我的問題。 –

相關問題