Whenever I try to run my project as maven install, it creates a completely normal jar file. It is a swing gui application. However, when I click a button in the GUI that uses this websocket client, it ouputs the error below.
Exception in thread "Thread-2" java.lang.NoClassDefFoundError: com/neovisionaries/ws/client/WebSocketException
at bot.BotFunc.run(BotFunc.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: com.neovisionaries.ws.client.WebSocketException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 2 more
my pom.xml looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>HelixBot</groupId>
<artifactId>HelixBot</artifactId>
<version>1.1</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<mainClass>gui.GUIMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.neovisionaries</groupId>
<artifactId>nv-websocket-client</artifactId>
<version>2.14</version>
</dependency>
</dependencies>
<packaging>jar</packaging>
</project>
As you can see, the correct dependency is added, so I am not sure why this error is appearing. I have tried clean building it and checked the .project and .classpath files. It may be due to the fact that I converted it to maven from a regular java project, but I have not found anything. Please let me know if there is a possible solution.