I have a properties file in resource directory of my project and want to to write some property values by maven command when project build based on profile. Properties file look like this (application.properties):
server.port=${server.port}
report.workspacePath=${reporting.workspacePath}
server.path=/foo/foosame
server.filePath=/bar/bardir
this how my pom file look like:
<profiles>
<profile>
<id>server</id>
<properties>
<server.port>8080</server.port>
<reporting.workspacePath>/opt/reporting/backend2-instance/reporting</reporting.workspacePath>
</properties>
</profile>
<profile>
<id>staging</id>
<properties>
<server.port>8084</server.port>
<reporting.workspacePath>/opt/reporting/backend1-instance/reporting</reporting.workspacePath>
</properties>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<!--<excludes>
<exclude>*.properties</exclude>
</excludes> -->
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>compile</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.txt</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
But nothing writing into properties file when i run maven command like this:
mvn -Pstaging clean package
Can someone have clue what i am missing here.