| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| src | 2010-09-16 | ||
| properties-maven-plugin-1.0-SNAPSHOT.jar | 2010-09-16 | 9.6 kB | |
| Totals: 2 Items | 9.6 kB | 0 | |
The plugin reads property and xml files and declaring them as maven project properties:
versions:
1.0 - reads property files.
1.0.1 - added support xml files.
It as an alternate to properties in pom.xml.
Plugin documentation
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.
From properties file:
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>
From xml file:
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=path
If 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>
Sample name.properties:
pathServerLog=log
custom.resource=folder
…
prop3=value3
Sample name.xml:
<properties>
<pathServerLog>log</pathServerLog>
…
<prop3>value3</prop3>
<custom>
<resource>path</resource>
</custom>
</properties>
Can use:
in pom.xml:
<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