Maven 发布:使用程序集插件执行错误(多模块项目)
我有一个 Maven 多模块项目。在一个模块中,我们使用 maven-assemble-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 & version_number &.zip) 我不知道,为什么它会重命名 zip 文件!? (war中需要zip文件,但不是存储库中的单个文件。)但是如果maven想将其复制到那里,对我来说没问题,但为什么要重命名???
有人有什么想法吗?有什么办法可以在安装时排除文件吗?这是一个非常大的问题,因为在部署 maven 时想要将同名的 zip 文件上传到 maven 存储库,但在第二次复制时失败。 (因为有一个同名的zip文件......)
I have a maven multi-module project. In one module, we create 2 ZIP files with the maven-assembly-plugin. The configuration for this:
<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>
It is OK. But in the install phase, maven 'copy' these zip files into the local repository on the same file name!!! (module_name & version_number &.zip) And I don't know, why it renames tha zip files!? (zip files needed inside the war, but not in single files in the repository.) But if maven would like to copy its to there, it is ok for me, but why is the rename???
have anybody any idea? Is there any way to exclude files at the install? It is very big problem because, at deploy maven would like to upload the zip files with the same name to the maven repository, but at the second copy it fails. (because there is a zip files with the same name.... )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
附加它生成的程序集是程序集插件的标准行为到项目中,以便它们将作为项目的工件进行安装和部署。如果存在命名冲突,那是因为您没有为两个程序集提供不同的 ID。 程序集的 id 用于构造最终文件名。这是解决程序集之间的命名冲突的正确方法。
要阻止程序集作为工件附加到项目,从而阻止安装或部署它,请设置
attach
= false,在程序集插件的配置中。It's standard behavior for the assembly plugin to attach the assemblies it produces to the project so they'll be installed and deployed as artifacts of the project. If there's a naming conflict it's because you haven't given the two assemblies distinct ids. The id of the assembly is used in constructing the final file name. This is the proper way to resolve naming conflicts between assemblies.
To stop an assembly from being attached to the project as an artifact and thus prevent it from being installed or deployed, set
attach
= false, in the assembly plugin's configuration.