【问题标题】:Maven Assembly plugin: useTransitiveDependencies not working?Maven 程序集插件:useTransitiveDependencies 不起作用?
【发布时间】:2013-02-13 04:33:49
【问题描述】:

在我的程序集描述符中,我有以下内容:

<dependencySets>
    <dependencySet>
        <outputDirectory>ext</outputDirectory>
         <useTransitiveDependencies>false</useTransitiveDependencies>
        <excludes>
            <exclude>group1:artifact1:jar:${pom.version}</exclude>
            <exclude>group2:artifact2:jar:${pom.version}</exclude>
        </excludes>
    </dependencySet>
</dependencySets>

当运行 mvn dependency:tree 我得到以下示例:

[INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile

我想要实现的是我的 ext 文件夹中只有 string-context。当设置 useTransitiveDependencies 如上所述时,ext 目录根本不存在,并且在删除属性时,我的 ext 文件夹中有所有 thress jar。

任何人都知道我可以如何排除 spring-aopaopalliance

乔纳斯

【问题讨论】:

    标签: maven dependencies maven-assembly-plugin


    【解决方案1】:

    useTransitiveFiltering 设置为true。如果你在dependencySet 中使用include/exclude,你应该考虑这个选项。

    【讨论】:

    • 这救了我 ;)
    【解决方案2】:

    我会说spring-context应该适合你,不是传递依赖,而是直接依赖。

    如果您接受允许传递依赖项,则将要包含的依赖项的选择委托给依赖项 POM。

    【讨论】:

      【解决方案3】:

      程序集描述符中有一个简单的条目:

            <useTransitiveDependencies>false</useTransitiveDependencies> 
      

      应该可以解决你的问题

      【讨论】:

        【解决方案4】:

        有人知道我如何排除 spring-aop 和 aopalliance 吗?

        与:

        <exclude>org.springframework:spring-aop:jar:3.0.5.RELEASE</exclude>
        <exclude>aopalliance:aopalliance:jar:1.0</exclude>
        

        【讨论】:

        • 是的,我现在如何手动排除它们,但这两个只是一个例子,我的 depedency:tree 包含大约 100 个传递依赖项。另外,我不想每次都在这里添加排除项为您的项目添加新的依赖项。
        【解决方案5】:

        您是否尝试过使用调试标志运行这个 maven 命令?请使用调试标志运行它,您会找到解决方案。

        【讨论】:

          猜你喜欢
          • 2010-11-07
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-12-12
          • 2017-08-15
          相关资源
          最近更新 更多