Search code examples
javamavenmaven-2maven-3

Maven Resource Plugin Migration


I have a Maven Java project, that uses maven-resources-plugin version 2.3, I am trying to migrate to a newer maven-resources-plugin version ,but when I put a versior later than 2.3, the propertys are not replaced.

Examples: With 2.3 version, compiled application.properties:

server.contextPath=/rsc/
server.port=8082
trac.datasource.url=jdbc:mariadb://localhost:3306/RSC

With version 2.4 or later:

server.contextPath=/rsc/
server.port=${prop.server.port}
trac.datasource.url=${prop.trac.datasource.url}

Al the props are on the POM, on a Profile:

<profiles>
        <!-- Develop Profile -->
        <profile>
            <id>develop</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>environment.type</name>
                    <value>develop</value>
                </property>
            </activation>
            <properties>
                <prop.server.port>8082</prop.server.port>
                <prop.trac.datasource.url>jdbc:mariadb://localhost:3306/RSC</prop.trac.datasource.url>
            </properties>
        </profile>
    </profiles>

On version 2.4 and later, I get this error:

Could not resolve placeholder 'prop.trac.datasource.url' in value "${prop.trac.datasource.url}"

Because the property is not replaced with the value. Any ideas? I do not see where the problem is.


Solution

  • Solved.

    On maven-resources-plugin version 2.4 and later, the format for the replacements is:

    [email protected]@