1

I have a parent maven project that includes some child projects and a build/assembly project. The structure looks like this

ParentProj
    + pom.xml 
    + ChildProj1
        ++   pom.xml
    + ChildProj2
     ++   pom.xml
    + buildProj
     ++   pom.xml

I want to create an executable jar in the build project, or project that contains all child project jars. Basically the final result should be a jar that includes all child project jars in the classpath.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
adeelmahmood
  • 2,371
  • 8
  • 36
  • 59

1 Answers1

0

Your project buildProj should have the other child projects declared as dependencies, you could then configure the maven assembly plugin to use the predefined descriptor jar-with-dependencies which create a jar that contains the dependencies.

EDIT If you wish to add the dependencies jar in your jar, you could use something like onejar:

There is a maven plugin for this tool: https://code.google.com/p/onejar-maven-plugin/

Community
  • 1
  • 1
Hugo G.
  • 636
  • 6
  • 21
  • is there a way to include all dependencies as jars under lib folder inside the build jar. instead of deflating everything in the build jar – adeelmahmood Feb 26 '14 at 17:06
  • ended up using this solution which is kind of mix of things but works https://github.com/larsgeorge/hbase-book/tree/master/ch07 – adeelmahmood Feb 27 '14 at 19:04