properties-files-maven-plugin

Maven plugin to help merge properties files.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.carmatechnologies.maven
ArtifactId

ArtifactId

properties-files-maven-plugin
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

properties-files-maven-plugin
Maven plugin to help merge properties files.
Project URL

Project URL

https://github.com/marccarre/properties-files-maven-plugin
Source Code Management

Source Code Management

https://github.com/marccarre/properties-files-maven-plugin.git

Download properties-files-maven-plugin

How to add to project

<plugin>
    <groupId>com.carmatechnologies.maven</groupId>
    <artifactId>properties-files-maven-plugin</artifactId>
    <version>0.2</version>
</plugin>

Dependencies

compile (3)

Group / Artifact Type Version
com.google.guava : guava jar 17.0
org.apache.commons : commons-lang3 jar 3.3.2
commons-configuration : commons-configuration jar 1.10

provided (7)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 2.2.1
org.apache.maven : maven-project jar 2.2.1
org.apache.maven : maven-core jar 2.2.1
org.apache.maven : maven-model jar 2.2.1
org.codehaus.plexus : plexus-container-default jar 1.0-alpha-9-stable-1
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.3
org.codehaus.plexus : plexus-utils jar 3.0.17

test (3)

Group / Artifact Type Version
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 1.2
org.hamcrest : hamcrest-all jar 1.3
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Build Status Coverage Status

A Maven plugin to manipulate properties files in an easy way.

Features:

  • Merge multiple properties files into a single one.
  • Merge multiple properties files into a single one, in parallel.
  • Resources filtering (using System, Maven and merged properties).
  • On missing input file, either skip and log warning or throw error.

Latest version (from either Maven Central or OSS Sonatype):

<dependency>
  <groupId>com.carmatechnologies.maven</groupId>
  <artifactId>properties-files-maven-plugin</artifactId>
  <version>0.2</version>
</dependency>

Example #1 - Merge using default merger (parallel merger):

<build>
    <plugins>
        <plugin>
            <groupId>com.carmatechnologies.maven</groupId>
            <artifactId>properties-files-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>merge</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <operations>
                    <operation>
                        <targetFile>${basedir}/target/merged.properties</targetFile>
                        <sourceFileSets>
                            <sourceFileSet>
                                <directory>${basedir}/src/main/resources</directory>
                                <includes>
                                    <include>a.properties</include>
                                    <include>b.properties</include>
                                </includes>
                            </sourceFileSet>
                            <sourceFileSet>
                                <directory>${basedir}/src/main/resources/env</directory>
                                <includes>
                                    <include>**/*.properties</include>
                                </includes>
                            </sourceFileSet>
                        </sourceFileSets>
                    </operation>
                </operations>
            </configuration>
        </plugin>
    </plugins>
</build>

Example #2 - Merge using simple merger:

<build>
    <plugins>
        <plugin>
            <groupId>com.carmatechnologies.maven</groupId>
            <artifactId>properties-files-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>merge</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <parallel>false</parallel>
                <operations>
                    <operation>
                        <targetFile>${basedir}/target/merged.properties</targetFile>
                        <sourceFileSets>
                            <sourceFileSet>
                                <directory>${basedir}/src/main/resources</directory>
                                <includes>
                                    <include>a.properties</include>
                                    <include>b.properties</include>
                                </includes>
                            </sourceFileSet>
                            <sourceFileSet>
                                <directory>${basedir}/src/main/resources/env</directory>
                                <includes>
                                    <include>**/*.properties</include>
                                </includes>
                            </sourceFileSet>
                        </sourceFileSets>
                    </operation>
                </operations>
            </configuration>
        </plugin>
    </plugins>
</build>

Example #3 - Merge using resource filtering:

<build>
    <plugins>
        <plugin>
            <groupId>com.carmatechnologies.maven</groupId>
            <artifactId>properties-files-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>merge</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <operations>
                    <operation>
                        <filtering>true</filtering>
                        [...]
                    </operation>
                </operations>
            </configuration>
        </plugin>
    </plugins>
</build>

Example #4 - Fail on missing input properties file:

<build>
    <plugins>
        <plugin>
            <groupId>com.carmatechnologies.maven</groupId>
            <artifactId>properties-files-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>merge</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <operations>
                    <operation>
                        <errorOnMissingFile>true</errorOnMissingFile>
                        [...]
                    </operation>
                </operations>
            </configuration>
        </plugin>
    </plugins>
</build>

Versions

Version
0.2