Meaningless Drivel is fun!*
The moose likes Ant, Maven and Other Build Tools and the fly likes Unable to create one single jar file in maven with dependencies included inside Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Unable to create one single jar file in maven with dependencies included inside" Watch "Unable to create one single jar file in maven with dependencies included inside" New topic
Author

Unable to create one single jar file in maven with dependencies included inside

sumit anand kumar
Ranch Hand

Joined: Apr 28, 2010
Posts: 83
Hi all,

Currently my application was simple core java and hibernate which was non-compatible with the maven directory structure. I had to change my project to a maven project.
I had one Java project A which used another Java project B to create a fat jar. Previously I used the eclipse fat jar plugin in which all the dependencies including Java project B where getting included as jar inside the lib folder of Java project A's jar.
Now i have created one parent project and included the Java project A and Java project B as modules inside it. Its building and the jars are created, but Java project B's compiled jar and other dependencies are not inside Java project A's jar now the same way they used to be earlier. So now if i execute my Java project A's jar, it throws error as class files for Java project B and other dependencies are not found in the class path. I want one single jar that's portable and there should be no need to set classpath at client's environment.

I have used the following links with limited success.

http://www.synthesisstudios.com/blog/2006/08/18/using-maven2-to-build-a-single-stand-alone-jar-file/
http://www.javaworld.com/javaworld/jw-12-2005/jw-1205-maven.html
http://www.thekua.com/atwork/2008/10/generating-a-single-fat-jar-artifact-from-maven/
http://gabrito.com/post/building-one-big-fat-jar-file

My Parent POM :


Module A's POM :



ModuleB's pom:



Please guide and help
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Your description after "but" was cut off so we're not sure what the problem is . Also I recommend following "Maven the Definitive Guide", the free online PDF (and hard cover book) by Sonatype who are pretty much the creators of Maven


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
sumit anand kumar
Ranch Hand

Joined: Apr 28, 2010
Posts: 83
Martijn Verburg wrote:Your description after "but" was cut off so we're not sure what the problem is


Updated my earlier description
 
jQuery in Action, 2nd edition
 
subject: Unable to create one single jar file in maven with dependencies included inside