我正在使用 Maven 插件:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>parse-version</id>
<goals>
<goal>parse-version</goal>
</goals>
</execution>
</executions>
</plugin>
解析项目版本。它工作正常:
[INFO] --- build-helper-maven-plugin:3.0.0:parse-version (parse-version)
[INFO]
[INFO] --- maven-antrun-plugin:1.1:run (default)
[INFO] Executing tasks
[echo] Major: 2
[echo] Minor: 0
[echo] Incremental: 0
[echo] Qualifier: SNAPSHOT
[echo] BuildNumber: 0
但是如果我想在配置文件属性中使用属性 parsedVersion.majorVersion,它就无法解决。
<profiles>
<profile>
<id>local</id>
<properties>
<majorVersion>${myMajorVersion}</majorVersion>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<properties>
<myMajorVersion>${parsedVersion.majorVersion}</myMajorVersion>
任何想法?