javamavenapp-bundle

appbundle-maven-plugin fails on mac OSX with java 10


I try to package my app using appbundle-maven-plugin, but I get the follwoing error:

[ERROR] Failed to execute goal sh.tak.appbundler:appbundle-maven-plugin:1.2.0:bundle (default) on project mailAutomatedReply: Execution default of goal sh.tak.appbundler:appbundle-maven-plugin:1.2.0:bundle failed: An API incompatibility was encountered while executing sh.tak.appbundler:appbundle-maven-plugin:1.2.0:bundle: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>sh.tak.appbundler:appbundle-maven-plugin:1.2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/home/.m2/repository/sh/tak/appbundler/appbundle-maven-plugin/1.2.0/appbundle-maven-plugin-1.2.0.jar
[ERROR] urls[1] = file:/Users/home/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar
.
.
.
[ERROR] Number of foreign imports: 1

The plugin definition is the following:

         <plugin>
            <groupId>sh.tak.appbundler</groupId>
            <artifactId>appbundle-maven-plugin</artifactId>
            <version>1.2.0</version>
            <configuration>
                <mainClass>package.SwingMainApp</mainClass>
                <bundleName>Inscription</bundleName>
                <iconFile>logoInscriptionsApp.png</iconFile>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>bundle</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

java version is the following:

> java -version
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Thanks


Solution

  • You need to use the latest dependencies: add this inside your <plugin>.

    <plugin>
        <groupId>sh.tak.appbundler</groupId>
        <artifactId>appbundle-maven-plugin</artifactId>
        <version>1.2.0</version>
        <dependencies>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-archiver</artifactId>
                <version>RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.apache.velocity</groupId>
                <artifactId>velocity-tools</artifactId>
                <version>2.0</version>
            </dependency>
        </dependencies>
        <configuration>
            <mainClass>package.SwingMainApp</mainClass>
            <bundleName>Inscription</bundleName>
            <iconFile>logoInscriptionsApp.icns</iconFile>
        </configuration>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>bundle</goal>
                </goals>
            </execution>
        </executions>
    </plugin>