The intersection of technology and leadership

Generating a single fat jar artifact from maven

When using the jar-with-dependencies descriptorRef for the maven-assembly-plugin, it creates two files by default, the normal default jar with any library dependencies excluded, and a second jar with all the libraries included appended with “jar-with-dependencies”. Since I find maven help guides unintuitive, it took a while before we found the appendAssemblyId option to turn it off. Here’s the snippet of the pom.xml to create just a single far jar.



  1. n0rad

    I was looking for that to !

    I tried your solution but it doesnt work for me
    maven tells me :

    [INFO] An invalid artifact was detected.

    This artifact might be in your project’s POM, or it might have been included transitively during the resolution process. Here is the information we do have for
    this artifact:

    o GroupID: test.test2
    o ArtifactID: myid
    o Version: 1.0-SNAPSHOT
    o Type: jar

    which is actually the project that i’m trying to package

    do you have an idee for that ?

  2. n0rad

    i missed some information :

    org.apache.maven.artifact.InvalidArtifactRTException: For artifact {test.test2:myid:1.0-SNAPSHOT:jar}: An attached artifact must have a different ID than its corresponding main artifact.

  3. Patrick

    I did a couple of searches, and here’s some links I found:

    I think it’s saying that you probably have the goal for the plugin as attached instead of what I have above, assembly. I never tried that, so I have no idea if that works. It would also help to see your pom.xml.

    Please leave a comment if this worked for you.

  4. sunilkumar

    I also encountered the same problem as n0rad.

    i changed


    now it works fine


  5. Michael Krog

    Thank you..

    Saved my day!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2022 patkua@work

Theme by Anders NorenUp ↑