GithubHelp home page GithubHelp logo

idealista / property-merger Goto Github PK

View Code? Open in Web Editor NEW
1.0 25.0 0.0 96 KB

Property-merger is a Maven project built to compute differences and merge property files

License: Apache License 2.0

Java 100.00%
java maven localization internacionalization i18n l10n properties property-files

property-merger's Introduction

Logo

Property-merger

Property-merger is a Maven project built to compute differences and merge property files.

What is a Property File?

Property files are mainly used in Java related technologies to store configurable parameters of and application and i18n/l10n strings (known as 'Property Resource Bundles'). Each parameter is stored as key/value pairs; one storing the name of the parameter (key) and the other storing the value.

Property files normally uses the .properties filename extension.

How it's used

With Property-merger mainly you can compute differences between two Java Property files and merge this differences.

How to generate an executable Jar file from sources

  1. Clone this repository
$ git clone https://github.com/idealista/property-merger.git
  1. Run Maven Package to package this Maven project into an executable Jar file
$ ./mvnw package

This command will produce a jar in the target folder -> ./target/property-merger-1.1.0-jar-with-dependencies.jar

  1. Execute the Jar generated in the second step
$ java -jar ./target/property-merger-1.1.0-jar-with-dependencies.jar -h
usage: java -jar <property_merger_jar_path> --help | java -jar <property_merger_jar_path> --version | java -jar <property_merger_jar_path> -l <left_file_path> -r <right_file_path>
            -o <DIFF | MERGE [--with-addition] [--with-deletion] [--with-modification] [--with-remove-base-escapes]>
GitHub Page: https://www.github.com/idealista/property-merger
 -h,--help                        print this message
 -l,--leftFilePath <FILE PATH>    left file path
 -o,--operation <DIFF|MERGE>      operation to execute
 -r,--rightFilePath <FILE PATH>   right file path
 -v,--version                     print version
    --with-addition               addition configured for merge (default to false)
    --with-deletion               deletion configured for merge (default to false)
    --with-modification           modification configured for merge (default to false)
    --with-remove-base-escapes    remove escape character from base file (default to false)

Operations

Diff Operation

Given two property files, Property-merger generates an output describing which parameters are added, modified or deleted (comparing base file to other file).

Result Description
Added Parameter New parameter (new key) appears in the second file
Modified Parameter Same parameter (same key) appears with different values in both files
Deleted Parameter A parameter that appears in the first file doesn't appear in the second one

Example

Base File (base.properties)

#
# other comment
#
foo.bar=baz {0}
qux.quux=waldo {0}, fred {1}

Other File (other.properties)

#
# example comment
#
qux.quux=corge {0}, grault {1}
norf.plugh=wyzzy {0}

Will produce:

$ java -jar ./target/property-merger-1.1.0-jar-with-dependencies.jar -l ./samples/base.properties -r ./samples/other.properties -o DIFF
------ [1] Added Properties ------
norf.plugh = wyzzy {0}

------ [1] Modified Properties ------
qux.quux = corge {0}, grault {1}

------ [1] Deleted Properties ------
foo.bar = baz {0}

Note: The diff operation ignores comments and does not take into account the order in which the parameters were defined.

Using the files below the diff command won't display any change:

Base File (base.properties)

#
# example comment
#
foo.bar=baz {0}
qux.quux=corge {0}, grault {1}

Other File (other.properties)

#
# other comment
#
qux.quux=corge {0}, grault {1}
foo.bar=baz {0}

Will produce:

$ java -jar ./target/property-merger-1.1.0-jar-with-dependencies.jar -l ./samples/base.properties -r ./samples/other.properties -o DIFF
------ [0] Added Properties ------

------ [0] Modified Properties ------

------ [0] Deleted Properties ------

Requirements

The library has been tested with Apache Maven 3.3.9 (Maven Wrapper is included to provide a fully encapsulated build setup) and JDK 1.8. Newer versions of Apache Maven/JDK should work but could also present issues.

License

Apache 2.0 Licence

This project is licensed under the Apache 2.0 license - see the LICENSE file for details.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

property-merger's People

Contributors

dortegau avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

property-merger's Issues

Add Probot stale config to avoid abandoned Issues/PRs

Prerequisites

Description

It would be nice to automatically close staled issues. There are a nice GitHub Integration built with Probot that closes abandoned issues after a period of inactivity: https://github.com/apps/stale

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.