How to Switch Maven osxappbundle-maven-plugin to use AppBundlerTask

866 views Asked by At

I have a Java Swing project that I like to package for OSX by bundling up into App bundle.

I previously used a Maven osxappbundle-maven-plugin to achieve this. But these bundles do not work with Oracle's Java for Mac and I want to switch things to use Oracle's App Bundler.

It appears that Oracle's bundler is only available as an Ant Task and I'm not sure how to convert this into a Maven command.

My previous pom.xml used the following:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>osxappbundle-maven-plugin</artifactId>
  <version>1.0-alpha-2</version>
  <configuration>
    <mainClass>${mainClass}</mainClass>
    <dictionaryFile>${basedir}/src/main/resources/Info.plist</dictionaryFile>
    <iconFile>${basedir}/src/main/resources/timelord.icns</iconFile>
    <javaApplicationStub>${basedir}/src/main/resources/JavaApplicationStub</javaApplicationStub>
    <jvmVersion>1.5+</jvmVersion>
  </configuration>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>bundle</goal>
      </goals>
    </execution>
  </executions>
</plugin>

I think I need to do something like this - but not sure the format. How should this be formatted? Or is there a Maven plugin already built that uses Oracle's Bundler?

  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
     <version>1.3</version>
     <executions>
      <execution>
        <phase>package</phase>
        <configuration>
          <tasks>
            <bundleapp outputdirectory="dist"
              name="${AppName}"
              displayname="${AppDisplayName}"
              identifier="${mainClass}"
              mainclassname="${mainClass}">

              <runtime dir="${env.JAVA_HOME}" />
              <classpath file="NOT SURE HOW TO MAKE THIS" />
            </bundleapp>
          </tasks>
        </configuration>
      </execution>
     </executions>
  </plugin>
1

There are 1 answers

1
Ari Maniatis On BEST ANSWER

There is now a maven plugin for the Java 7/8 compatible oracle bundler