It will product 3 jars: root.jar, projectA.jar and projectB.jar. Then they are all be published to my local maven repository.
The question is that I don’t want to produce the root.jar, how to prevent to generate it and not publish to repository.
Because the root project is the empty folder without any source codes, it just a multi-project maintainer for me. It SHOULD not be produce any artifact.
include 'root:projectA'
include 'root:projectB'
project(":root:projectA").projectDir = new File("projectA/")
project(":root:projectB").projectDir = new File("projectB/")
but when integration build, I create a ‘integration’ gradle project to include the ‘root’ project and ‘sample’ project.
The ‘sample’ project is the client project to use the ‘root’ project API in the development phase.
So this is multi-project gradle setting to include another multi-project gradle setting.
and the settings.gradle of integration project is:
rootProject.name = "integration"
include 'root'
include 'root:projectA'
include 'root:projectB'
include 'sample'
project(":root").projectDir = new File("../root")
project(":root:projectA").projectDir = new File("../root/projectA")
project(":root:projectB").projectDir = new File("../root/projectB")
project(":sample").projectDir = new File("../sample")
and the integration, root, and sample project are flat multi-project as following:
Not sure it help you, because you’re using standard publication plugin.
But I’m using com.vanniktech.maven.publish plugin and I just tell gradle to not apply it to the root project via following snippet:
plugins {
id "com.vanniktech.maven.publish" version "0.18.0" apply false
}
After this, empty jar disappeared from publications.