Fork me on GitHub

Properties Maven Plugin

The Properties Maven Plugin is here to make life a little easier when dealing with properties. It provides goals to read properties from files and URLs and write properties to files, and also to set system properties.

It's main use-case is loading properties from files or URLs instead of declaring them in pom.xml, something that comes in handy when dealing with different environments.

If you have a properties file called teams.properties with this content:

  toronto=raptors
  miami=heat

and invoke the properties:read-project-properties goal, it would be the same as declaring the following in your pom.xml:

  <properties>
    <toronto>raptors</toronto>
    <miami>heat</miami>
  </properties>

The properties loaded from files or URLs can be used to filter resources differently for different environments. Those using Spring's PropertyPlaceholderConfigurer can see how these goals can be useful. Note that the URL format accepts Spring's classpath: style pseudo-URL syntax.

Goals Overview

Usage

Instructions on how to use the Properties Maven Plugin can be found here.