Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to set value in property file from pom build using maven resource plugin

I have one property file called environment.properties. In this file I have one entry:

applicationUrl = ${applicationUrlFromPom}

I want to use maven resource plugin setting in pom file, so that this value could be set at build time and I can use this value from properties file in Java.

thnx in advance

like image 630
sumit Avatar asked Sep 17 '13 15:09

sumit


1 Answers

Assuming you have properties in your pom as

<properties>
   <applicationUrlFromPom>http://www.coolbeans.com/some/url</applicationUrlFromPom>
</properties>

You need to add resource filtering

<resources>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
    </resource>
</resources>

where the <directory> is the directory your properties file is in.

like image 52
Sotirios Delimanolis Avatar answered Sep 28 '22 06:09

Sotirios Delimanolis