sumit
sumit

Reputation: 189

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

Upvotes: 5

Views: 4498

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 280175

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.

Upvotes: 6

Related Questions