我有一个maven多模块项目。在一个模块中,我们使用maven-assembly-plugin创建2个ZIP文件。配置:
<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将这些zip文件“复制”到同一文件名的本地存储库中! (module_name&amp; version_number&amp; .zip)我不知道,为什么它重命名了zip文件!? (在战争中需要的zip文件,但不是存储库中的单个文件。)但是如果maven想要将其复制到那里,那对我来说没问题,但为什么要重命名???
有任何人有任何想法吗?有没有办法在安装时排除文件?这是一个非常大的问题,因为在部署时,maven想要将具有相同名称的zip文件上传到maven存储库,但是在第二个副本上它会失败。 (因为有一个同名的zip文件....)
答案 0 :(得分: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。这是解决程序集之间命名冲突的正确方法。
要阻止程序集作为工件附加到项目,从而阻止其安装或部署,请设置{{3}}。