logo Properties Maven Plugin

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

homepage: www.mojohaus.org/properties-maven-plugin
fresh index:
last release: 7 years ago, first release: 1 decade ago
packaging: maven-plugin
get this artifact from: central pentaho-repo
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
properties:write-active-profile-properties

Writes properties of all active profiles to a file.

properties:read-project-properties

The read-project-properties goal reads property files and stores the properties as project properties. It serves as an alternate to specifying properties in pom.xml.

properties:write-project-properties

Writes project properties to a file.

Often used code snippets:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>${properties-maven-plugin.version}</version>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>read-project-properties</goal>
      </goals>
      <configuration>
        <files>
          <file>sonar-project.properties</file>
        </files>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <id>apps-metadata</id>
      <phase>process-classes</phase>
      <goals>
        <goal>read-project-properties</goal>
      </goals>
      <configuration>
        <files>
          <file>${project.build.outputDirectory}/META-INF/spring-configuration-metadata-encoded.properties</file>
        </files>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>set-system-properties</goal>
      </goals>
      <configuration>
        <properties>
          <property>
            <name>org.jdom2.output.LineSeparator</name>
            <value>SYSTEM</value>
          </property>
        </properties>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0-alpha-2</version>
  <executions>
    <execution>
      <phase>generate-resources</phase>
      <goals>
        <goal>write-active-profile-properties</goal>
      </goals>
      <configuration>
        <outputFile>${project.build.outputDirectory}/application.properties</outputFile>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>properties-maven-plugin</artifactId>
  <version>1.0.0</version>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>read-project-properties</goal>
      </goals>
      <configuration>
        <files>
          <file>${basedir}/build.properties</file>
        </files>
      </configuration>
    </execution>
  </executions>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.