Fork me on GitHub

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.11</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>

And then build your project, jlink starts automatically.

mvn clean verify

Or you can start the plugin manually.

mvn jlink:jlink

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

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>