1) Make sure you have the maven war compiler plugin.
2) Add the profile based on your environment.
3) Create a property folder on the resource path
4) Add a place holder in the property file. service.url=${service.url}
5) Run the Maven Command with the Profile clean install -PUAT
6) Verify in built WAR in WEB-INF/Classes
XML Changes to Pom.xml:-
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources >
<webResource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<includes>
<include>*.properties</include>
</includes>
</webResource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>UAT</id>
<properties>
<service.url>sanalsamuel</service.url>
</properties>
</profile>
</profiles>
2) Add the profile based on your environment.
3) Create a property folder on the resource path
4) Add a place holder in the property file. service.url=${service.url}
5) Run the Maven Command with the Profile clean install -PUAT
6) Verify in built WAR in WEB-INF/Classes
XML Changes to Pom.xml:-
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources >
<webResource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<includes>
<include>*.properties</include>
</includes>
</webResource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>UAT</id>
<properties>
<service.url>sanalsamuel</service.url>
</properties>
</profile>
</profiles>