gpt4 book ai didi

java - 如何访问maven多模块项目中其他模块pom中定义的属性

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:59:58 25 4
gpt4 key购买 nike

在 A.B.C 的 pom 中,我将一个属性定义为 abc,其中 A B C 是模块。现在我想在 A.D.F 模块的 pom 中访问该属性。

<properties>
<A.B.C>${buildNumber}</A.B.C>
</properties>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>buildnumber</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<timestampFormat>{0,date,dd-MM-yyyy HH:mm:ss}</timestampFormat>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
<revisiononscmfailure>

<!-- 71 Generate sequence build number based on: 72 build number and
timestamp 73 -->

<format>Build: #{0} ({1,date})</format>

<items>

<item>buildNumber\d*</item>

<item>timestamp</item>

</items>

</revisiononscmfailure>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>

</plugin>

我在 A.D.F 模块的 pom 中使用 ${A.B.C} 作为依赖项中的版本值。

<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version>${A.B.C}</version>
<type>bundle</type>
</dependency>

所以它给我错误:bundle 必须是有效版本,但为 ${A.B.C}。

编辑:

或者我可以按照我定义的方式使用 C 模块的版本吗:

<version>${A.B.C}</version> 

最佳答案

这些模块是否共享父 pom?似乎如果您希望它们链接起来,让它们通过父级共享属性是个好主意,尤其是如果您想在许多模块之间紧密耦合模块版本。

关于java - 如何访问maven多模块项目中其他模块pom中定义的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25499579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com