Domanda

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.

È stato utile?

Soluzione

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/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top