为什么maven-assembly-plugin会多次在我的zip中添加相同的依赖项?

时间:2009-05-11 15:12:40

标签: java maven-2 build maven-plugin

我把汇编描述符放在一起

<assembly>
<id>all</id>
<formats>
    <format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
    <moduleSet>
        <includes>
            <include>org.openscada.atlantis:org.openscada.atlantis.core.common</include>
            <include>org.openscada.atlantis:org.openscada.atlantis.net.base</include>
            <include>org.openscada.atlantis:org.openscada.atlantis.core.net.base</include>
            ... some more ...
            <include>org.openscada.atlantis:org.openscada.atlantis.spring.components</include>
        </includes>
        <binaries>
            <includeDependencies>true</includeDependencies>
            <outputDirectory>bin</outputDirectory>
            <unpack>false</unpack>
            <dependencySets>
                <dependencySet>
                    <outputDirectory>lib</outputDirectory>
                    <useTransitiveFiltering>true</useTransitiveFiltering>
                </dependencySet>
            </dependencySets>
        </binaries>
    </moduleSet>
</moduleSets>
</assembly>

没什么特别的,但是现在我的依赖项被多次包含在zip文件中(完全相同的文件)。为什么会发生这种情况,我该如何防止这种情况发生? (我想也许使用useTransitiveFiltering会阻止它,但是没有)

为了说明它在zip文件中的外观如下:

Screenshot Zip File http://www.openscada.org/AtlantisMavenBuild?action=AttachFile&do=get&target=multiple-deps.png

1 个答案:

答案 0 :(得分:7)

这是程序集插件中的一个错误。大约一年前我也注意到了。最新版本的程序集插件没有问题。我建议您将正在使用的程序集插件的版本更新为2.2 beta 3.它应该可以解决您的问题。

  <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <groupId>org.apache.maven.plugins</groupId>
      <version>2.2-beta-3</version>
  </plugin>