properties-maven-plugin
properties-maven-plugin copied to clipboard
Warning appears when use property from the file in pom.xml version tag.
I am trying to use this plugin to read version value from the properties file. I took a sample from official site:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>src/main/resources/version.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
and in pom.xml I use key from the version.properties file like this:
<version>${application.version}</version>
But when I run package goal, I see following output:
[WARNING]
[WARNING] Some problems were encountered while building the effective model for my.project:server:jar:${application.version}
[WARNING] 'version' contains an expression but should be a constant. @ line 11, column 14
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------------------< my.project:server >--------------------------
[INFO] Building server ${application.version}
[INFO] --------------------------------[ jar ]---------------------------------
I tried different phases, but result always is the same. Why this warning appears and how to resolve it?
Thanks.
Try revision
as placeholder.
https://maven.apache.org/maven-ci-friendly.html
Warning has gone, but I see such message:
[INFO] -------------------------< my.project:server >--------------------------
[INFO] Building server ${revision}
[INFO] --------------------------------[ jar ]---------------------------------
Here version still is not substituted for some reason.
But final artifact contains version number as expected.
Pleass look at #115