Maven-publish include jar as a dependency


(Marcelo Severgnini) #1


I have the following structure

Project A
--------Project B
----------------Project D
----------------Project E

I use the maven-publish plugin in the project D and E to generate the jars, the project D has a project E as a dependency.
I would like config my build to generate project E.jar to include(embed) in project B, with that I don’t need put these two dependencies in another project, only one.

I can’t figure out how could I do that.

I have the following configuration in these two projects (D and E).

publishing {

publications {

    mavenJava(MavenPublication) {
        groupId  group
        version version
        artifact sourceJar


repositories {

    maven {
        url domain
        credentials {
            username User
            password Pass


task sourceJar(type: Jar, dependsOn: classes) {

classifier 'sources’
from sourceSets.main.allSource

Thanks for helping