versions: 1.0 - reads property files. 1.0.1 - added support xml files.
Goals available:
| Goal | Description |
|---|---|
| add-properties-to-project | Goal reads property files and declaring the properties as maven project properties. |
| add-xml-properties-to-project | Goal reads xml files and declaring the properties as maven project properties. |
| Configuration | Description |
|---|---|
| files | Contains all the "*.properties" files. |
| file | Contains the path to the ".properties" file. |
Sample:
<project>
<build>
<plugins>
<plugin>
<groupId>net.sourceforge.properties</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.1-SNAPSHOT</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>add-properties-to-project</goal>
</goals>
<configuration>
<files>
<file>${basedir}/path/name.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
| Configuration | Description |
|---|---|
| xmlfiles | Contains all the "*.xml" files. |
| file | Contains the path to the ".xml" file. |
| isCanonicalName | Builds a full path to the value. e.g.
<properties>
<custom>
<resource>path</resource>
</custom>
</properties>
If isCanonicalName="true": custom.resource=pathIf isCanonicalName="false": folder=path Not mandatory. By default use: "false" |
| spacer |
Indicates a separator used to separate elements. e.g. custom.folder=path If the default "." : custom.resource=path If spacer="-": custom-resource=path Used only if the isCanonicalName="true". Not mandatory. By default use: "." |
Sample:
<project>
<build>
<plugins>
<plugin>
<groupId>net.sourceforge.properties</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.1-SNAPSHOT</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>add-xml-properties-to-project</goal>
</goals>
<configuration>
<isCanonicalName>true</isCanonicalName>
<spacer>.</spacer>
<xmlfiles>
<file>${basedir}/path/name.properties</file>
</xmlfiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<properties>
<pathServerLog>log</pathServerLog>
…
<prop3>value3</prop3>
<custom>
<resource>path</resource>
</custom>
</properties>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/custom-resources/${custom.resource}</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
folder ${basedir}/src/main/custom-resources/${custom.resource}:
file1.xml :
<server>
<path>${pathServerLog}<path>
</server>
multi-module structure sample:
.
|-- properties-files
| |-- src
| | `-- name1.properties
| |-- src
| | `-- name2.properties
| `-- src
| `-- name3.properties
|-- common-module
| |-- pom.xml
| `-- src
| `-- main
| `-- java
| `-- test.class
|-- modules
| |-- module_1
| | |-- pom.xml
| | `-- src
| | `-- main
| | `-- java
| | `-- test.class
| |-- module_2
| | |-- pom.xml
| | `-- src
| | `-- main
| | `-- java
| | `-- test.class
| `-- module_3
| |-- pom.xml
| `-- src
| `-- main
| `-- java
| `-- test.class
|-- pom.xml
|-- README
`-- web-module
|-- pom.xml
`-- src
`-- main
`-- java
`-- test.class