Thomas Sundberg

March 5, 2011

Create an executable jar from Maven

Filed under: Java, Maven — Tags: , , , , — Thomas Sundberg @ 17:54

This post is available at


  1. Thanks for the good info, however, I still get many exceptions with a spring dependency I’m using. I’ve seen other forms use the maven-jar-plugin and/or the maven-shade-plugin. Do you need more than just the assembly plugin?

    Comment by Daniel — May 12, 2011 @ 17:38

    • I have created executable jars with a setup like this without problems and exceptions. The exceptions you encounter may be caused by other things than the assembly plugin.

      Comment by Thomas Sundberg — May 12, 2011 @ 21:36

  2. Hey, at last I found something that works!!! I have been all the day searching but nothing seemed to work until I found your blog.
    Thank you very much, mate! You have helped me a lot 🙂

    Comment by David — July 17, 2011 @ 15:29

  3. Thanks Thomas for this perfect article!!! Appreciate your work!!

    Comment by Anton — October 21, 2012 @ 18:55

  4. Hi Thomas,
    Thanks for the clearly written article. I wonder if you have ever had to deal with a problem where common top-level resources like would be overwritten by the various other jars that contain it? If so, how did you cope with that?

    Comment by Brendan — November 8, 2012 @ 18:02

    • Hi!

      I don’t think I have experienced that. If I did, I would explore the Maven capability to exclude parts of a dependency. This may not be enough or easy, but this is where I would start.

      I am glad that you found my blog to be clear and easy to read. It is one of my goals, to write things that are easy to access and understand.


      Comment by Thomas Sundberg — November 8, 2012 @ 20:46

      • In the end I just changed my main to pick up an explicitly named properties file in an non-standard directory, instead of expecting my file to be picked out of the classpath in preference to other identically-named files.

        Comment by Brendan — November 26, 2012 @ 13:41

  5. Thx for your post, it helped me,

    Comment by sadiq81 — August 22, 2013 @ 21:48

  6. Thanks for posting. Was really helpful

    Comment by Mohan — August 19, 2014 @ 13:46

  7. Hi , could you please help me on how to bundle dependency jars into executable jar , I am unable to download one jar plugin..pls suggest f there is any other alternati

    Comment by Sree — February 2, 2015 @ 19:15

    • Hi!

      If you read and follow the blog post you commented, what happened then? Which part where you not able to understand and use?


      Comment by Thomas Sundberg — February 3, 2015 @ 06:40

      • Hi thomas,

        if i do that i have the message:
        Hauptklasse se.sigma.educational.main konnte nicht gefunden oder geladen werden

        Comment by karl — July 29, 2015 @ 11:21

      • Hi!

        The error message indicates, if understand the German, that you are missing the name of the class you are trying to execute. It should be named


        And it is important to notice the capital M in Main. Java cares about the casing of letters.


        Comment by Thomas Sundberg — July 31, 2015 @ 21:44

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: