Plugin to generate jars with module information as Maven Plugin

The maven main core project description

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.mt-ag.tools.maven
ArtifactId

ArtifactId

jar-module-maven-plugin
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Plugin to generate jars with module information as Maven Plugin
The maven main core project description
Project URL

Project URL

http://github.com/mt-ag/jar-module-maven-plugin
Project Organization

Project Organization

MT AG
Source Code Management

Source Code Management

http://github.com/mt-ag/jar-module-maven-plugin/tree/master

Download jar-module-maven-plugin

How to add to project

<plugin>
    <groupId>com.mt-ag.tools.maven</groupId>
    <artifactId>jar-module-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.6.0

provided (2)

Group / Artifact Type Version
org.apache.maven : maven-core jar 3.6.0
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0

test (1)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.4.2

Project Modules

There are no modules declared in this project.

Introduction

jar-module is a plugin for maven to package the jar.

The first option is to clean a jar file from the directory entries and to set the main-class in module-main.class as found in the manifest file.

The main option is to call jlink to generate a java with only the used modules as runtime. All needed jar are copied in one directory to update the automatic modules to be real modules.
After that the call to jlink is possible.

The other option is to generate an installer for windows, macOS, linux or an image. It uses the javapackager and it's required tools. Only available for Java 9 and 10 of Oracle JDK. Not in Open JDK.

Documentation

The generated site documentation of the maven plugin jar-module can be viewed at

https://mt-ag.github.io/jar-module-maven-plugin/

Requirements

Java version 9 or newer.

Maven to build the maven-plugin.

Maven to use the maven-plugin.

For goal javapackager an Oracle JDK 9 or 10 is needed.

Download

The link to the maven repository: https://search.maven.org/search?q=a:jar-module-maven-plugin

Build

Usage

<plugin>
    <groupId>com.mt-ag.tools.maven</groupId>
    <artifactId>jar-module-maven-plugin</artifactId>
    <version>1.0</version>
    <configuration>
        <repack>true</repack>
        <openmodule>false</openmodule>
        <appName>LinkListe</appName>
        <appMenuGroup>MT AG</appMenuGroup>
        <appVendor>MT AG</appVendor>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>jlink</goal>
                <goal>javapackager</goal>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The goal jar sets the main-class if it is a module and the main class is not set but the Main-Class is set in the manifest. Cleans the jar if repack is true.

The goal jlink calls the jlink in the sub dir modules and copies all jars from the dependencies to the modules folder. The new java runtime is found in the run sub folder. It is packed as zip-file in the artifact name ending with .run.zip. The classifier is run in the additional artifact.

The goal javapackager calls the javapackager to create an installer for the jar. The installer is packed into the zip-file in the artifact name ending with .install.zip. The classifier is install in the additional artifact.

com.mt-ag.tools.maven

MT AG

Versions

Version
1.0