NoClassDefFoundError on Maven dependency

By default, Maven doesn’t bundle dependencies in the JAR file it builds, and you’re not providing them on the classpath when you’re trying to execute your JAR file at the command-line. This is why the Java VM can’t find the library class files when trying to execute your code. You could manually specify the libraries … Read more

Make Maven to copy dependencies into target/lib

This works for me: <project> … <profiles> <profile> <id>qa</id> <build> <plugins> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>install</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>