【发布时间】:2018-11-14 20:32:23
【问题描述】:
我正在使用 maven 的依赖管理将 POM 导入到我的项目 Y 中,如下所示:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.abc</groupId>
<artifactId>X</artifactId>
<version>1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
我的工件 X 具有以下我想在项目 Y 的 POM 中访问的属性:
<properties>
<property1>value1</property1>
<property2>value2</property2>
</properties>
我无法将 X 中定义的属性访问到项目 Y 中。我知道使用上述方法我无法使用插件管理,但我无法在网络上找到与属性相关的任何内容。
另外请注意,我不能使用工件 X 作为父级,因为我们已经定义了项目级父级。
能否请您指导一下。
【问题讨论】:
-
将依赖项放在
dependencyManagement之外。在dependencyManagement`中,您只定义使用哪个lib,如果它在其他模块中使用 -
@Jens:我们只需要使用依赖管理导入某些依赖项,因为它是一种 BOM
标签: java maven dependency-management maven-dependency