Вопрос

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.

Это было полезно?

Решение

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/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top