File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sumit anand kumar
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
sumit anand kumar
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg wrote:Your description after "but" was cut off so we're not sure what the problem is


Updated my earlier description
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic