【问题标题】:Maven release:perform error with assembly plugin (Multi module project)Maven 发布:使用程序集插件执行错误(多模块项目)
【发布时间】:2011-10-20 12:38:18
【问题描述】:

我有一个 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 & version_number &.zip) 而且我不知道,为什么它重命名 tha zip 文件!? (战争中需要的zip文件,而不是存储库中的单个文件。)但是如果maven想将其复制到那里,对我来说没问题,但是为什么要重命名???

有人知道吗?有没有办法在安装时排除文件?这是一个非常大的问题,因为在部署时,maven 想将同名的 zip 文件上传到 maven 存储库,但在第二次复制时它失败了。 (因为有一个同名的zip文件....)

【问题讨论】:

    标签: java maven build maven-release-plugin


    【解决方案1】:

    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

    【讨论】:

    • 谢谢!完美的答案。 attach=false 解决了我的问题。
    猜你喜欢
    • 2013-07-11
    • 2020-05-27
    • 2014-07-27
    • 2016-01-10
    • 2011-03-09
    • 2017-07-26
    • 2011-10-07
    • 1970-01-01
    • 2022-08-15
    相关资源
    最近更新 更多