Home

Awesome

really-executable-jar-maven-plugin

Maven

Usage

There is an introductory blog post at http://skife.org/java/unix/2011/06/20/really_executable_jars.html

To use:

  1. Make sure you build an "uberjar" with a main class in the MANIFEST. See the Maven Shade plugin's documentation for one way of doing this.
  2. Add this plugin to your build to make the JAR directly executable. All configuration parameters are optional; the defaults should work for many cases.
<plugin>
  <groupId>org.skife.maven</groupId>
  <artifactId>really-executable-jar-maven-plugin</artifactId>
  <version>2.1.1</version>
  <configuration>
    <!-- (optional) flags to be interpolated into the java invocation -->
    <!-- as "java $flags -jar ..." -->
    <flags>-Xmx1G</flags>
    
    <!-- (optional) input file name: only this specific file will be made executable -->
    <inputFile>target/fooBla.jar</inputFile>
    
    <!-- (optional) classifier name: only artifacts with this classifier are made executable -->
    <classifier>shaded</classifier>

    <!-- (optional) support other packaging formats than jar -->
    <allowOtherTypes>true</allowOtherTypes>

    <!-- (optional) name for a new binary executable, if not set will just
         make the original artifact executable -->
    <programFile>nifty-executable</programFile>
    
    <!-- (optional) name for a file that will define what script gets
         embedded into the executable jar.  This can be used to
         override the default startup script which is
         `#!/bin/sh
         
         exec java " + flags + " -jar "$0" "$@" -->
    <scriptFile>src/packaging/someScript.extension</scriptFile>
  </configuration>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>really-executable-jar</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Changes

2.1.1

2.1.0

2.0.0

1.4.0

1.3.0

1.2.0

1.1.0

1.0.0