 ------
 Usage
 ------
 Zarar Siddiqi
 ------
 2007-07-18
 ------


Usage

* read-project-properties

  The {{{./read-project-properties-mojo.html}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>${project.version}</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>${project.version}</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>read-project-properties</goal>
            </goals>
            <configuration>
              <urls>
                <url>classpath:/config/dev.properties</url>
                <url>file:///${env.HOME}/mydev.properties</file>
              </urls>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
----------------

* write-project-properties

  The {{{./write-project-properties-mojo.html}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>${project.version}</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>
----------------

* write-active-profile-properties

  The {{{./write-active-profile-properties-mojo.html}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>${project.version}</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 {{{./set-system-properties-mojo.html}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>${project.version}</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>
----------------
