Results 1 to 2 of 2

Thread: package to jar

  1. #1
    Join Date
    Jul 2006
    Posts
    6

    Default 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. #2
    Join Date
    May 2005
    Posts
    394

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •