我有一个多模块项目,我在父 pom 中使用配置文件,其中提到了特定的依赖项。这里的问题是,如果在子 pom 中,我覆盖了依赖项元素,并提到了父 pom 中的依赖项之一(在父 pom 的配置文件中声明),则该特定依赖项的版本需要是再次提到。
例如父 pom
<dependencies>
<dependency>
<groupId>com.mycode.apps</groupId>
<artifactId>jobs</artifactId>
<version>4</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>common-dependencies</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.mycode.apps</groupId>
<artifactId>dao</artifactId>
<version>4</version>
</dependency>
</dependencies>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
现在在子 pom.xml
<dependencies>
<!--this one doesnt need a version specified -->
<dependency>
<groupId>com.mycode.apps</groupId>
<artifactId>jobs</artifactId>
</dependency>
<!--this one makes maven throw an error(if version is not specified) while compilation -->
<dependency>
<groupId>com.mycode.apps</groupId>
<artifactId>dao</artifactId>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
知道什么可能是错的,我该如何解决这个问题?
注意:配置文件被标记为 activeByDefault
| 归档时间: |
|
| 查看次数: |
6988 次 |
| 最近记录: |