我正在使用以下方式从文件中读取属性:
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.basedir}/jenkins/version.properties</file>
</files>
</configuration>
</execution>
</executions>
子项目中包含的pom.xmls使用从属性文件中提取的属性,如下所示:
<manifestEntries>
<Built-Date>${maven.build.timestamp}</Built-Date>
<Version>${VERSION}B${BUILD_NUMBER}</Version>
</manifestEntries>
问题是,当他们调用project.parent.basedir时,他们没有使用父项目,他们正在父项上方的目录中查找version.properties文件。关于如何使他们使用正确的目录的任何想法?我无法使用project.basedir,因为他们会在自己的项目目录中查找该文件,这也不正确。