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

  • package to jar

    Hello,

    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.

  • #2
    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[1] and added in the Class-Path[2].

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

    Comment

    Working...
    X