Announcement Announcement Module
No announcement yet.
package to jar Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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<clinit>(

    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.

  • #2
    This is a maven question, see maven user list on

    Just make sure the dependency jars are also copied to the target directory[1] and added in the Class-Path[2].

    [1] see maven assembly plugin
    [2] see maven jar plugin configuration