无法访问pom属性

时间:2018-05-03 10:58:33

标签: maven properties yaml maven-plugin maven-versions-plugin

我正在使用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>

任何想法?

0 个答案:

没有答案