0

I'm trying to achieve a relatively simple task - To inject a maven property to my properties file. In my pom.xml I have:

<properties>
    <rt.env>staging</rt.env>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>13</java.version>
    <artifact-name>MY-App</artifact-name>
    <heroku.appName>my-app-${rt.env}</heroku.appName>
</properties>

In the build section:

<build>
    <finalName>${artifact-name}-${project.version}</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

and in my resources folder I have a properties file with property:

runtime.environment=${rt.env}

But after creating the jar file using mvn install the properties file inside the jar does not get the value of the property from the pom file.

What am I missing?

forhas
  • 11,551
  • 21
  • 77
  • 111

0 Answers0