Usage
read-project-properties
The properties:read-project-properties goal reads property files or URLs and stores them as project properties.
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>etc/config/dev.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
or alternatively
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<urls>
<url>classpath:/config/dev.properties</url>
<file>file:///${env.HOME}/mydev.properties</file>
</urls>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
write-project-properties
The properties:write-project-properties goal writes all project properties to a given file.
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>write-project-properties</goal>
</goals>
<configuration>
<outputFile>
${project.build.outputDirectory}/app.properties
</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
By default only the project properties are written. Set includeUserProperties to true to also write the user properties of the Maven session, that is the values given with -D on the command line, for example -Dbuild.id=42. Other JVM system properties are not written, and includedPropertyKeys and excludedPropertyKeys apply to the user properties too.
<configuration>
<includeUserProperties>true</includeUserProperties>
<outputFile>
${project.build.outputDirectory}/app.properties
</outputFile>
</configuration>
write-active-profile-properties
The properties:write-active-profile-properties goal writes properties of all active profiles to a given file.
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>write-active-profile-properties</goal>
</goals>
<configuration>
<outputFile>
${project.build.outputDirectory}/app.properties
</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
set-system-properties
The properties:set-system-properties goal sets the specified system properties.
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>my.property.name</name>
<value>my.property.value</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>


