Maven is a popular build tool used for Java applications. I develop small utilities for not technical people, which can be run without too much technical knowledge.
This requires the JAR I'm building to have all the dependent libraries available and the program can be initiated by just opening the JAR provided Java installed properly in the machine
If we're developing the Maven application, libraries are provided in the pom.xml file which then, in turn, is downloaded during the build time but by default, these external dependent libraries aren't included as part of the generated JAR file.
Include the below plugin under "plugins" section of the pom.xml file. Please make sure to modify your main class full qualified path
<plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>com.santhoshreddymandadi.Main</mainClass> </manifest> </archive> </configuration> </plugin>