I've tried and follow this solution How to read an external properties file in Maven but with no luck.
I would like to read an absolute path(/home/tomcat/lib) from a properties file(which is in the same location as pom.xml) and set the value in the pom.xml
project.properties file contains:
myTomCat.lib.location=/home/tomcat/lib
pom.xml configuration contains:
<properties>
<envTomcatLib>${myTomCat.lib.location}</envTomcatLib>
</properties>
<dependencies>
<dependency>
<artifactId>MyJar</artifactId>
<groupId>MyJar</groupId>
<scope>system</scope>
<version>1.0</version>
<systemPath>/${envTomcatLib}/MyJar.jar</systemPath>
</dependency>
</dependencies>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/project.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
The problem is either at eclipse compile time or running "mvn install" that the placeholder ${envTomcatLib}/MyJar.jar, can't get resolved to /home/tomcat/lib/MyJar.jar and remains ${envTomcatLib}/MyJar.jar.
Can someone please assist?
Thanks