federkasten / appbundle-maven-plugin

Maven plugin that creates an Application Bundle for OS X containing all your project dependencies and the necessary metadata
Apache License 2.0
179 stars 56 forks source link

NullPointer with SWT #19

Open mojo2012 opened 9 years ago

mojo2012 commented 9 years ago

Hi,

I have a problem packaging a jar into a mac app bundle.

With these two plugins I can package everything into one single jar file that I can start on the command line:

    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
    <source>1.8</source>
    <target>1.8</target>
    </configuration>
    </plugin>
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
    <archive>
        <manifest>
        <mainClass>at.spot.velocityeditor.Application</mainClass>
        </manifest>
    </archive>
    <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
    </configuration>
    <executions>
    <execution>
        <id>make-assembly</id> <!-- this is used for inheritance merges -->
        <phase>package</phase> <!-- bind to the packaging phase -->
        <goals>
        <goal>single</goal>
        </goals>
    </execution>
    </executions>
    </plugin>

Now I want to use this plugin:

    <plugin>
    <groupId>sh.tak.appbundler</groupId>
    <artifactId>appbundle-maven-plugin</artifactId>
    <version>1.0.4</version>
    <configuration>
    <jvmOptions>
        <jvmOption>-XstartOnFirstThread</jvmOption>
    </jvmOptions>
    <mainClass>at.spot.velocityeditor.Application</mainClass>
    </configuration>
    <executions>
    <execution>
        <phase>package</phase>
        <goals>
        <goal>bundle</goal>
        </goals>
    </execution>
    </executions>
    </plugin>

But unfortunately I get this stacktrace:

java.lang.NullPointerException
at org.eclipse.swt.widgets.Scrollable.getClientArea(Unknown Source)
at org.eclipse.swt.widgets.ToolBar.relayout(Unknown Source)
at org.eclipse.swt.widgets.ToolBar.createItem(Unknown Source)
at org.eclipse.swt.widgets.ToolItem.<init>(Unknown Source)
at at.spot.velocityeditor.Application.createToolbarButton(Application.java:211)

This indicated that an SWT library has not been found.

Is there any way to add all dependencies to the generated mac app bundle?

federkasten commented 8 years ago

I have confirmed those errors with your project, VelocityEditor.

It seems that all SWT jar files is bundled in the generated mac app bundle. I suppose some bugs remains in my library loader. I will try to fix them soon.

jdimeo commented 5 years ago

I've successfully used this plugin with SWT by using the Maven shade plugin