Git Product home page Git Product logo

fmerger's Introduction

 _______ .___  ___.  _______ .______        _______  _______ .______
|   ____||   \/   | |   ____||   _  \      /  _____||   ____||   _  \
|  |__   |  \  /  | |  |__   |  |_)  |    |  |  __  |  |__   |  |_)  |
|   __|  |  |\/|  | |   __|  |      /     |  | |_ | |   __|  |      /
|  |     |  |  |  | |  |____ |  |\  \----.|  |__| | |  |____ |  |\  \----.
|__|     |__|  |__| |_______|| _| `._____| \______| |_______|| _| `._____|

Getting Started

Fmerger is a plugin that you can merge all files configured in basic Java application. There can be many use case like merging the all .sql files in only single output file that you name with specific file name. Fmerger looks for files in classpath and that classpath path can be configured in pom.xml file. The specific file group separator can be configured, if it is became involved in configured the default separator '-'. The all configuration elements were explained in configuration section.

Requirement

java_version >= 1.8
maven_version >= 3.3.1

Configurations

The all piece of fmerger plugin will be analyzed step by step and at the end of this section, you can see the big picture of your build tag in your pom.xml file.


Path of all collected resources(parent)

<resourcePath>src/main/resources/</resourcePath>

File group content separator configured with twise minus, default is single minus.

<contentSeparator>--</contentSeparator>

All folders that are collected in resourcePath folder that is configured previously. Maybe those paths can be configured with the developers name or nickname etc. Note: That mechanism cannot work like recursive so it cannot find the inner folders. Your java app side will be like:

.
+-- src
|   +-- main
|   	+-- resources
|   		+-- okan.pehlivan
|   			+-- test.sql
|   			+-- another-test.sql
|   		+-- other.developer
|   			+-- developer-test.sql

<paths>
	<param>okan.pehlivan</param>
    <param>other.developer</param>
</paths>

The following configuration tags for all-in-one merged file outputs. It contains protocol(file directory), finalNamePrefix, path(last path to upload output file) and extension of file like .sql, .txt etc.

Note: The output file name will contains the timestamp and random number. The output file template seems like:

${output.finalNamePrefix}-<timestamp>-<randomNumber>-${output.extension}
<output>
    <protocol>file</protocol>
    <finalNamePrefix>my-file</finalNamePrefix>
    <path>/Users/semihokan/fmerger-collection</path>
    <extension>sql</extension>
</output>

The following config for archive configuration. When the argument is written to console as following:

-Darchive

It will create a new archive file if not existed in your file directory. And the last output file will be created in there and in ${output.path} also. Archive will clear all files that you worked on. Be carefull when you use it, but if you made a mistake check the archive folder, for the long files maybe you cannot seperate the file like previously. If you don't want to do that mistake, the snapshotPath config can be used before archive(release) to check the last output file what looks like, by using the following argument:

-Dsnapshot

Note: Your snapshot output file will be marked with -SNAPSHOT suffix.

<archive>
    <path>/Users/semihokan/fmerger-collection/archive</path>
    <protocol>file</protocol>
    <snapshotPath>/Users/semihokan/fmerger-collection/snapshot</snapshotPath>
</archive>

Last presentation of build tag in your pom.xml file of your java application.

<build>
    <plugins>
        <plugin>
            <groupId>com.sopehl</groupId>
            <artifactId>fmerger</artifactId>
            <version>1.0.1-alpha</version>
            <executions>
                <execution>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>merge</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                <resourcePath>src/main/resources/</resourcePath>

                <contentSeparator>---</contentSeparator>

                <paths>
                    <param>okan.pehlivan</param>
                    <param>other.developer</param>
                </paths>

                <output>
                    <protocol>file</protocol>
                    <finalNamePrefix>my-file</finalNamePrefix>
                    <path>/Users/semihokan/fmerger-collection</path>
                    <extension>sql</extension>
                </output>

                <archive>
                    <path>/Users/semihokan/fmerger-collection/archive</path>
                    <protocol>file</protocol>
                    <snapshotPath>/Users/semihokan/fmerger-collection/snapshot</snapshotPath>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

Additional arguments

-Dconsole // to print last output file content in console
-Darchive // to trigger archive options
-Dsnapshot // to trigger the snapshot options
-DfinalNamePrefix // override or specify the finalName(file name) prefix externally
-DdisableFinalNameSuffix // disable the final name suffix, by default it is {timestamp-randomNumber}
-DcontentSeperator // override the content separator externally

fmerger's People

Contributors

sopehl avatar dependabot[bot] avatar sercanparker avatar

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.