Nov 7th, 2006, 06:15 AM
package to jar
I used the simple app as a starting point for my application. Now it's complete and I want to export it to jar.
When I run the "mvn package" command, I get a jar file but it wont start.
>java -jar myapp-0.3.0-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at myapp.app.SimpleApp.<clinit>(SimpleApp.java:52)
The application can't find the commons-logging-1.1.jar (and any other libraries)
It runs perfectly in eclipse. I added all my libraries to Build Path there.
Also, is it wrong to use external libraries not from the maven repository? I created a "lib" folder in my project root, and copied some libraries there.
Nov 7th, 2006, 09:25 AM
This is a maven question, see maven user list on news.gmane.org.
Just make sure the dependency jars are also copied to the target directory and added in the Class-Path.
 see maven assembly plugin
 see maven jar plugin configuration