Hey, so I worked on a project that I want to run as an executable jar from the command line. I was able to create a jar of dependencies using Mavens assembly: single command. My pom looks like this.
<build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.3</version> <configuration> <archive> <manifest> <mainClass>org.openmetadata.main.OmadUpdate</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build>
The build is successful and creates jar omad-update-0.0.1-SNAPSHOT-jar-with-dependencies.jar. I go to my project target folder on the command line and type
java -jar omad-update-0.0.1-SNAPSHOT-jar-with-dependencies.jar
I also tried
java -cp omad-update-0.0.1-SNAPSHOT-jar-with-dependencies.jar org.openmetadata.main.OmadUpdate
Unfortunately, in each case, I'm assigned java.lang.NoClassDefFoundError: org / openmetadata / main / OmadUpdate. I am confused because I know that my main class is in the package org.openmetadata.main, and yet it was not found. I find this particularly confusing because in my pom I am specifying this class as my main class. I tried changing the name of the main class to src.main.java.org.openmetadata.main.OmadUpdate and just OmadUpdate, but none of them have an effect. Thanks for any help in advance.
decal source share