Code Monkey home page Code Monkey logo

unfork-maven-plugin's Introduction

UnFork Maven Plugin

Did you ever want to change something small in a dependency you were using but don't want to fork the entire project?

The UnFork Maven Plugin allows you to easily swap out single files from an existing dependency during project compilation.

Set up UnFork

Create a new maven project and configure the pom.xml:

The UnFork plugin resolves the original artifact by taking the defined groupId, artifactId and version. The version is truncated to the - symbol.

<project>
    ...
    <groupId>org.jobrunr</groupId>
    <artifactId>jobrunr</artifactId>
    <version>6.2.2-neoutil</version>
    ...
</project>

Add the following bit to the build section of the UnForked pom.xml.

<build>
    <plugins>
        <plugin>
            <groupId>com.neoministein.tools</groupId>
            <artifactId>unfork-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>unfork-source</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Add the dependencies of the original artifact to the UnForked pom.xml.

<dependencies>
    ...
</dependencies>

Recommendation

It is recommended to use a multi module maven project in order to not have to rely on an external project, since this would defeat the purpose of the UnFork plugin.

Example project structure:

+-- root
|    +-- pom.xml
+-- src
|    +-- ...
+-- pom.xml
+-- unfork
|    +-- unfork-project-1
|    +-- unfork-project-2

Use UnFork

If the project is set up correctly run the maven compile command:

$ mvn clean package

UnFork will extract the original files from the artifact and place them into the target folder:

+-- src
|    +-- ...
+-- target
|    +-- classes
|    +-- generated-resources
|         +-- src <-- Original resource files get placed here
|    +-- generated-sources
|         +-- src <-- Original java files get placed here
+-- pom.xml

To modify an existing file copy it from target to src and recompile the project. A file won't be added to generated-sources/-resources when a file with the same name and package already exists in the src directory.

Local Project Setup

Following programs are needed:

  • jdk: 11
  • maven: 3.9.3

Compile

$ mvn clean package

unfork-maven-plugin's People

Contributors

neoministein avatar

Stargazers

Odair Vaz avatar Franck Arnulfo avatar Suresh avatar Nándor Holozsnyák avatar Attila Bagossy avatar

Watchers

 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.