Skip to content

Warning appears when use property from the file in pom.xml version tag. #89

@hexwit

Description

@hexwit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions