I have a Swing application that uses classes from Maven artifact math.geom2d:javaGeom:0.11.1
. To create a jar file in A GitHub Release I use a modified "fatJar" build.gradle task, so the geom2d classes are included in the jar file. For the jar file for my application on Maven, I don't include the geom2d classes, so these classes don't show up in that jar file, but they are referenced as dependencies.
What is odd is that on my machine this (smaller) jar file works fine consistently, so I thought everything was OK, even if strange! I decided to try it on my wife's machine and it crashes with a NoClassDefFoundError. I thought maybe it was because she didn't have Maven installed... tried installing it, but no difference! Help would be appreciated!
Here is the pom.xml on Maven for my app:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jpaulmorrison</groupId>
<artifactId>drawfbp</artifactId>
<version>2.18.4</version>
<name>DrawFBP</name>
<description>Diagramming Tool for Flow-Based Programming</description>
<url>https://github.com/jpaulm/drawfbp</url>
<licenses>
<license>
<name>GNU Lesser General Public License, Version 3.0</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>jpaulmorr</id>
<name>
John Paul Rodker Morrison (Software architect/developer)
</name>
<email>jpaulmorr@gmail.com</email>
</developer>
<developer>
<id>bobcorrick</id>
<name>Bob Corrick (Software architect/developer)</name>
<email>bobcorrick@outlook.com</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/jpaulm.git</connection>
<developerConnection>scm:git:https://github.com/jpaulm.git</developerConnection>
<url>https://github.com/jpaulm.git</url>
</scm>
<dependencies>
<dependency>
<groupId>math.geom2d</groupId>
<artifactId>javaGeom</artifactId>
<version>0.11.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Thanks @samvel1024 ! I now have a better handle on what is going on:
the jar file without the geom2d classes could run because I had geom2d in my classpath - it doesn't any more!
I create a fatJar using a task in build.gradle, but uploadArchives creates a new jar file, which isn't "fat"!
so, I would either like to add the fatJar task to my uploadArchives function,
OR
- suppress the 'jar' task in uploadArchives, so it doesn't mess up the "fat" jar that I already have! I have tried "jar.enabled = boolean variable", but I can't set it to "false"...
Either of these two options should be easy in a sensible language, but I can't get either to work! Help would be appreciated!