Is there a maven jigsaw jlink plugin?

Viewed 2332

Does maven have a plugin for the new Java 9 jlink I have searched online but have not been able to find anything official from the maven team.

4 Answers

there is mvn-jlink plugin which allows to call jdeps and jlink (and any tool provided by jdk), also it can download and unpack needed openjdk version from ADOPT and LIBERICA, such way allows build cross-platform images

<plugin>
    <groupId>com.igormaznitsa</groupId>
    <artifactId>mvn-jlink-wrapper</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <id>call-jlink</id>
            <goals>
                <goal>jlink</goal>
            </goals>
            <configuration>
                <jdepsReportPath>${project.build.directory}${file.separator}jdeps.out</jdepsReportPath>
                <output>${project.build.directory}${file.separator}preparedJDK</output>
                <addModules>
                    <module>java.compiler</module>
                </addModules>
                <options>
                    <option>--compress=2</option>
                    <option>--no-header-files</option>
                    <option>--no-man-pages</option>
                </options>
            </configuration>
        </execution>
    </executions>
</plugin>

Maybe check out https://github.com/ghackenberg/jigsaw-maven-plugin. The plugin also supports

  • jdeps --generate-module-info + javac + jar for patching unnamed modules,
  • jlink for creating runtime images, and
  • jpackage for creating application installers (only available since JDK 14 though).

You find the plugin documentation on the Github README page.

<plugin>
   <groupId>io.github.ghackenberg</groupId>
   <artifactId>jigsaw-maven-plugin</artifactId>
   <version>1.1.2</version>
</plugin>
Related