Giter VIP home page Giter VIP logo

jar-modularizer's Introduction

JarModularizer

This project is a lightweight command line java tool for make non-modular JAR files compatible with Java Platform Module System. Was inspired in the ModiTect's moditect-maven-plugin idea but nothing of it code was copied, studied or simply consulted for develop this project.

See brother project PyJarModularizer.

Usage

The way JarModularizer work is simple. It need a configuration JSON file, called modularization descriptor, with the description of how each JAR file, called artifact, will should become in a java module and the source directory path, wich is where non-modular JARs files will be found.

Prerequisites

  • JDK 9 or later because is requires by JarModularizer for do its work.
  • Maven as project management tool.

Example

1 - Compile and package with Maven using the command mvn clean package.

2 - Execute de following command:

java -jar jar-modularizer-<version>-jar-with-dependencies.jar --descriptor <file-path> --source <dir-path>

Command above will deposite the new modular JAR copies in --source/mods directory with fallowing name pattern: original.jar-mod.jar (ej. for log4j-1.2.17.jar new file name will be log4j-1.2.17.jar-mod.jar).

Important!

Only that files wich name (including .jar extension) match with an entry in modularization descriptor will be processed.

Getting help

If --help param is using, tool's help will be diplayed in the terminal.

Modularization descriptor format

As was mentioned above, the modularization descriptor is a JSON file. Below show it format.

Note: JSON format doesn't allow comments, so java-style inline comment texts are only for descriptive purposes.

[
    {
        "name": "log4j-1.2.17.jar",// artifact name
        "module": {// module entry
            "name": "log4j",// future module name
            "exportsPackages": [// (optional) list of artifact's packages to be exported by the future module. Default is all artifact non-empty packages
                "org.apache.log4j",
                "org.apache.log4j.net"
            ],
            "requiresModules": [// (optional) list of requires directive to be included in module-info.java. Dafault is none diretive
                "java.base",
                "java.desktop",
                "java.management",
                "java.naming",
                "java.sql",
                "java.xml"
            ]
        }
    },
    ...
]

Author

Eduardo Betanzos @ebetanzosm

License

This project is licensed under the MIT License - see the LICENSE file for details.

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.