我想在构建后解决所有修订标签,所以我使用flatten。我有一个像这样的多模块项目:
问题在于B的扁平化pom中未解析
这是我如何配置扁平化:
A (root)
|_B (parent = A, dependencyManagement with version = ${revision}
|_C (parent = B, dependencies declared in dependencyManagement without specifying the version)
问题在于B的扁平化pom中未解析
${revision}
。此外,在C的扁平化pom中,版本仍然缺失,而我期望在B的dependencyManagement中声明版本。这是我如何配置扁平化:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
我尝试将这个部分添加到<configuration>
标签内:
<pomElements>
<dependencyManagement>expand</dependencyManagement>
<dependencies>expand</dependencies>
</pomElements>
这在一定程度上解决了问题,因为它解决了所有版本的问题,但pom文件过于冗长,因为它扩展了所有父级依赖。因此,结果是C的平面化pom明确包含B和A中声明的所有依赖项以及B的dependencyManagement。
有没有办法仅仅解决版本问题,而不必扩展子pom中的所有依赖关系?
bom
,而为其他模块使用oss
。我将所有的依赖管理都放在我的bom模块中。这可能会帮助你克服这个问题。 - eHayikdependencyManagement
部分声明的依赖项。 - eHayik