I am trying to read the properties from a property file into my parent pom.xml
. From there I need to put the read properties to the variables defined in my html file.
Code for including properties file :
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<!-- Associate the read-project-properties goal with the initialize phase, to read the properties file. -->
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/build.${build.env}.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<!-- Maven War file generator plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/java</directory>
<targetPath>WEB-INF/classes</targetPath>
<includes>
<include>**/*.properties</include>
<filtering>false</filtering>
<include>**/*.xml</include>
<filtering>false</filtering>
<include>**/*.css</include>
<filtering>false</filtering>
<include>**/*.html</include>
<filtering>true</filtering>
</includes>
</resource>
</webResources>
</configuration>
<version>2.3</version>
</plugin>
<!-- Maven compiler plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<version>2.3</version>
</plugin>
</plugins>
I was using ant before and there I was using filterset
tag to apply these filters like
code in build.xml:
<filterset>
<filter token="HOSTNAME_PREFIX" value="${hostname.prefix}"/>
<filter token="MIN_SUFFIX" value="${min.suffix}"/>
<filter token="APP_VERSION" value="${build.app.version}"/>
</filterset>
but I dont know how to achieve the same thing using maven.
the code to be replaced in index.html is :
<link rel="shortcut icon" href="@HOSTNAME_PREFIX@appimages/app-logo.ico" type="image/png"/>
<link rel="stylesheet" href="@HOSTNAME_PREFIX@css/jquery.mobile-1.2.0@MIN_SUFFIX@.css" />