Maven read an external properties file
Hi there,
Back to my project and one more lessons learn, on my study project I need maven to read values from my properties file, values like database host, password and etc…
Maven have a nice plugin called Properties Maven Plugin…
Here is the changes on your pom.xml
<!-- *************** MAVEN PROPERTIES PLUGIN *************** --> <dependency> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0-alpha-2</version> </dependency>
and…
<build>
<plugins>
(...)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/src/main/resources/your.properties</file>
</files>
</configuration>
</execution>
</executions>
(...)
</plugin>
(...)
And finally I discover a decent way to post source-code do wordpress!!!!!!!!!!!!!!!!!!!!!!!!!!
Advertisement


Is there is any precondition to this setup? I have parent-child pom.xml setup where I put the properties-maven-plugin in the parent pom. The properties are used in Any idea? Thanks
Btw, I am using Maven 3.0.3.