Reputation: 215
Just a quick question.
Does anyone knows an XML Properties file plugin , like we had XML property file in ANT
<property name='foo' value='bar'>
<property name='foo1' value='${foo}/bar1'>
<property name='foo2' value='bar2'>
Thanks in Advance
Note: I have an idea of using other ways of declaring properties in maven/ in pom.xml. Just want to know this exact way of implementation.
Upvotes: 4
Views: 4655
Reputation: 9059
The Properties Maven Plugin may meet your goal. The properties:read-project-properties will reads property files and stores them as project properties as the following example:-
<project>
<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>path/to/my_properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Please note, the path/to/my_properties
is a simple properties file which contains key-value pair as the following example: -
key1=value1
key2=value2
....
Regarding to the properties above, we can refer them via Maven by using ${key1}
or ${key2}
.
I hope this may help.
Upvotes: 5