【问题标题】:Maven transient dependency not brought in未引入 Maven 瞬态依赖
【发布时间】:2012-12-10 16:27:13
【问题描述】:

将分类器标签指定为配置文件一部分的临时依赖项是否默认没有引入?

更具体地说,我有一个项目 A,它定义了如下依赖项:

<dependency>
     <groupId>com.dependency1</groupId>
     <artifactId>dependency1</artifactId>
     <version>12</version>
     <classifier>${os.classifier}</classifier>
</dependency>

以及指定${os.classifier}的配置文件

<profiles>
    <profile>
        <id>x86</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <os.classifier>x86</os.classifier>
        </properties>
    </profile>
    <profile>
        <id>x86-64</id>
        <properties>
            <os.classifier>x86-64</os.classifier>
        </properties>
    </profile>
</profiles>

当我从项目 B 依赖项目 A 时,com.dependency1 没有被引入。我缺少什么或者这是默认行为吗?

【问题讨论】:

  • 您是否测试过如果不使用分类器会发生什么?我认为只有在整个链中使用分类器时才会引入与分类器的依赖关系。
  • 是的,将它留在项目 A 中是行不通的,因为它不会将 jar 作为依赖项引入(这会破坏项目 A 的构建)......除非你说的是别的意思“将分类器排除在外”。

标签: java maven dependencies dependency-management


【解决方案1】:

实际上引入了传递依赖。我的设置没有任何问题。我所要做的就是强制从项目 B 重新导入依赖项。

【讨论】:

    猜你喜欢
    • 2022-12-11
    • 1970-01-01
    • 2019-04-15
    • 1970-01-01
    • 2021-01-14
    • 2016-09-12
    • 2016-01-21
    • 2016-07-20
    • 1970-01-01
    相关资源
    最近更新 更多