2011-10-20 43 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解决了我的问题。 –

相关问题