The VASL module, which contains a lot of custom java classes, is structured as a Maven project which uses a pom.xml file to drive the VASL build. The VASSAL team has done a lot of work for us to shape that pom and run it in a way that produces the build that we need. All of this is working extremely well and building and releasing new versions of VASL is quite easy now.
Recently, I have been trying to add javafx to the code tools that we use. I can get this to work in a dev environment. The Maven build process continues to work. However, when I take the jar file and rename it to .vmod and then run it from the VASSAL window, I get a VASSAL bug.
I have added below the current pom file - I needed to add to it in order for the pom to include the javafx classes. I have also added the final lines from the Maven build output which highlights the probem (I think).
I have been reading about various methods to try and fix this and have tried some but to no avail.
Does anyone have any experience or ideas about this?
Thanks.
POM
4.0.0
<groupId>org.vasl</groupId>
<artifactId>vasl</artifactId>
<version>6.6.6-beta5</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.vassalengine</groupId>
<artifactId>vassal-app</artifactId>
<version>3.6.11</version>
</dependency>
<!-- We do not have any tests yet, but time will tell... -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<!-- Add dependencies that are not part of VASSAL here -->
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>vassal</id>
<url>https://vassalengine.org/maven</url>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>dist</directory>
<filtering>true</filtering>
<includes>
<include>buildFile</include>
<include>moduledata</include>
</includes>
</resource>
<resource>
<directory>dist</directory>
<filtering>false</filtering>
<excludes>
<exclude>buildFile</exclude>
<exclude>moduledata</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<verbose>true</verbose>
<source>11</source>
<target>11</target>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<executable>${jdk}/bin/java</executable>
<workingDirectory>${basedir}</workingDirectory>
<arguments>
<argument>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</argument>
<argument>-jar</argument>
<argument>Vengine-3.6.11.jar</argument>
<argument>--standalone</argument>
<argument>target/${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<!-- Add more jar to include here, but they need to be a
dependency as well. -->
<include>org.jdom:jdom2</include>
<include>org.openjfx:javafx-controls</include>
<include>org.openjfx:javafx-swing</include>
<include>org.openjfx:javafx-graphics</include>
<include>org.openjfx:javafx-base</include>
</includes>
</artifactSet>
<!--
<relocations>
<relocation>
<pattern>org.openjfx.javafx-controls</pattern>
<shadedPattern>org.shaded.javafx-controls</shadedPattern>
<excludes>
</excludes>
</relocation>
</relocations> -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<name>VASL</name>
<url>https://github.com/vasl-developers</url>
<licenses>
<license>
<name>GNU Lesser General Public License, version 2.1</name>
<url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html</url>
<distribution>distribution</distribution>
<comments>The GNU General Public License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.
</comments>
</license>
</licenses>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/vasl-developers/vasl/issues</url>
</issueManagement>
<scm>
<url>https://github.com/vasl-developers/vasl</url>
<connection>scm:git:git://github.com/vasl-developers/vasl.git</connection>
<developerConnection>scm:git:git@github.com:vasl-developers/vasl.git</developerConnection>
</scm>
Maven build output
Including org.jdom:jdom2:jar:2.0.5 in the shaded jar.
[INFO] Including org.openjfx:javafx-controls:jar:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-controls:jar:win:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-graphics:jar:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-graphics:jar:win:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-swing:jar:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-swing:jar:win:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-base:jar:19 in the shaded jar.
[INFO] Including org.openjfx:javafx-base:jar:win:19 in the shaded jar.
[INFO] Excluding org.openjfx:javafx-fxml:jar:19 from the shaded jar.
[INFO] Excluding org.openjfx:javafx-fxml:jar:win:19 from the shaded jar.
[WARNING] javafx-base-19-win.jar, javafx-graphics-19-win.jar, javafx-swing-19-win.jar, javafx-controls-19-win.jar define 1 overlappping classes:
[WARNING] - module-info
[WARNING] maven-shade-plugin has detected that some .class files
[WARNING] are present in two or more JARs. When this happens, only
[WARNING] one single version of the class is copied in the uberjar.
[WARNING] Usually this is not harmful and you can skeep these
[WARNING] warnings, otherwise try to manually exclude artifacts
[WARNING] based on mvn dependency:tree -Ddetail=true and the above
[WARNING] output
[WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing c:\Users\dougr_000\IdeaProjects\GameUpdater\target\vasl-6.6.6-beta5.jar with c:\Users\dougr_000\IdeaProjects\GameUpdater\target\vasl-6.6.6-beta5-shaded.jar
[INFO] Dependency-reduced POM written at: c:\Users\dougr_000\IdeaProjects\GameUpdater\dependency-reduced-pom.xml
[INFO] Dependency-reduced POM written at: c:\Users\dougr_000\IdeaProjects\GameUpdater\dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:28 min
[INFO] Finished at: 2023-02-09T10:19:59-05:00
[INFO] ------------------------------------------------------------------------