com.cedricwalter:properties-sync-maven-plugin

Apache maven plugin for failing fast at build time when using maven resources filtering with environment based filters. This maven plugin will force you to keep in sync all properties files with the reference.

Лицензия

Лицензия

Категории

Категории

Maven Компиляция и сборка
Группа

Группа

com.cedricwalter
Идентификатор

Идентификатор

properties-sync-maven-plugin
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

maven-plugin
Описание

Описание

com.cedricwalter:properties-sync-maven-plugin
Apache maven plugin for failing fast at build time when using maven resources filtering with environment based filters. This maven plugin will force you to keep in sync all properties files with the reference.
Ссылка на сайт

Ссылка на сайт

https://github.com/cedricwalter/properties-sync-maven-plugin
Система контроля версий

Система контроля версий

https://github.com/cedricwalter/properties-sync-maven-plugin.git

Скачать properties-sync-maven-plugin

Как подключить последнюю версию

<plugin>
    <groupId>com.cedricwalter</groupId>
    <artifactId>properties-sync-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.apache.maven : maven-plugin-api jar 3.3.9
commons-io : commons-io jar 2.5
com.google.guava : guava jar 20.0

provided (1)

Идентификатор библиотеки Тип Версия
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

Модули Проекта

Данный проект не имеет модулей.

Introduction

Apache maven plugin for failing fast at build time when using maven resources filtering with environment based <filters>

Scenario

  • You use maven filtering: some files get filtered because they may contains stage dependent values for example.
  • you have some properties files that are used, and need to be kept in sync with another reference.properties.

This maven plugin will force you to keep in sync all properties files with the reference.

In Short it compare files against a reference file and enforce consistency.

Quick Usage

properties-sync-maven-plugin is available in Maven Central.

<plugins>
    <plugin>
        <groupId>com.cedricwalter</groupId>
        <artifactId>properties-sync-maven-plugin</artifactId>
        <version>1.0</version>
        <executions>
            <execution>
                <goals>
                    <goal>properties</goal>
                </goals>
                <phase>process-resources</phase>
                <configuration>
                    <folder>${basedir}/src/main/resources</folder> <!-- optional here for sake of example -->
                    <reference>reference.properties</reference> <!-- optional here for sake of example -->
                    <pattern>[a-zA-Z]*.properties</pattern> <!-- optional here for sake of example -->
                </configuration>
            </execution>
        </executions>
    </plugin>
</plugins>

Complete example

Imagine you have a folder src/main/filters which contains

  • localhost.properties
  • host1.properties

You want to force developer to keep in sync localhost.properties and host1.properties

Example of filtering

<build>              
    <filters>
        <filter>${basedir}/src/main/filters/${hostname}.properties</filter>                   
    </filters>
    
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
                <execution>
                    <id>filter-resources</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>resources</goal>
                    </goals>
                    <configuration>
                        <nonFilteredFileExtensions>
                            <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
                            <nonFilteredFileExtension>zip</nonFilteredFileExtension>
                            <nonFilteredFileExtension>jks</nonFilteredFileExtension>
                            <!-- ... list them all of binary will be broken by maven filtering -->
                            <nonFilteredFileExtension>jar</nonFilteredFileExtension>
                            <nonFilteredFileExtension>tar.gz</nonFilteredFileExtension>
                        </nonFilteredFileExtensions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
                <groupId>com.cedricwalter</groupId>
                <artifactId>properties-sync-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                        <phase>process-resources</phase>
                        <configuration>
                            <folder>${basedir}/src/main/filters</folder> 
                            <reference>localhost.properties</reference> 
                            <pattern>host1.properties</pattern>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    </plugins>
</build>

The build will now failed if both files do not contains the same number of keys.

Версии библиотеки

Версия
1.0