JLink Maven Plugin

The jlink maven plugin is used to link Java 9+ projects

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

com.github.akman
ArtifactId

ArtifactId

jlink-maven-plugin
Last Version

Last Version

0.1.8
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

JLink Maven Plugin
The jlink maven plugin is used to link Java 9+ projects
Project URL

Project URL

https://github.com/akman/jlink-maven-plugin
Source Code Management

Source Code Management

https://github.com/akman/jlink-maven-plugin/tree/v0.1.8

Download jlink-maven-plugin

How to add to project

<plugin>
    <groupId>com.github.akman</groupId>
    <artifactId>jlink-maven-plugin</artifactId>
    <version>0.1.8</version>
</plugin>

Dependencies

compile (5)

Group / Artifact Type Version
org.apache.maven : maven-model jar 3.6.3
org.apache.maven.shared : file-management jar 3.0.0
org.codehaus.plexus : plexus-java jar 1.0.5
org.apache.commons : commons-lang3 jar 3.10
org.apache.commons : commons-text jar 1.8

provided (4)

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

test (4)

Group / Artifact Type Version
org.apache.maven : maven-compat jar 3.6.3
junit : junit jar 4.13
org.apache.maven.plugin-testing : maven-plugin-testing-harness jar 3.3.0
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

JLink Maven Plugin v0.1.8

Build Status Maven Central License

The jlink maven plugin lets you create a custom runtime image with the jlink tool introduced in Java 9.

The main idea is to avoid being tied to project artifacts and allow the user to fully control the process of creating an image. However, it is possible, of course, to customize the process using project artifacts.

The detailed documentation for this plugin is available here.

Goals

This plugin has two goals:

  • jlink:jlink is not bound to any phase within the Maven lifecycle and is therefore is not automatically executed, therefore the required phase must be specified explicitly.

  • jlink:help display help information on the plugin.

To create a custom runtime image manually you need only to execute:

mvn jlink:jlink

It will not fork (spawn a parallel) an alternate build lifecycle and will execute the jlink goal immediately.

To display parameter details execute:

mvn jlink:help -Ddetail=true

Usage

Add the plugin to your pom:

  <project>
    ...
    <build>
      <pluginManagement>
        <plugins>
          ...
          <plugin>
            <groupId>com.github.akman</groupId>
            <artifactId>jlink-maven-plugin</artifactId>
            <version>0.1.8</version>
          </plugin>
          ...
        </plugins>
      </pluginManagement>
    </build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>com.github.akman</groupId>
        <artifactId>jlink-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>jlink</goal>
            </goals>
            <configuration>
              <!-- put your configurations here -->
            </configuration>
          <execution>
        <executions>
      </plugin>
      ...
    </plugins>
    ...
  </project>

If you want to use snapshot versions of the plugin connect the snapshot repository in your pom.xml.

  <project>
    ...
    <pluginRepositories>
      <pluginRepository>
        <id>ossrh</id>
        <name>OSS Sonatype Snapshots Repository</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <layout>default</layout>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>
        <releases>
          <enabled>false</enabled>
        </releases>
      </pluginRepository>
    </pluginRepositories>
    ...
  </project>

And then build your project, jlink starts automatically:

mvn clean verify

Links

The JLink tool official description.

JEP-220 Modular runtime images.

Pull request

Pull request template: .github/pull_request_template.md.

Versions

Version
0.1.8
0.1.7
0.1.6
0.1.2
0.1.1
0.1.0