How customize hierarchical layout in multi-project builds?


(dusiabh) #1

I have following layout:

foo2\src\main\java\Foo2.java

proj1\ proj2\foobase\src\ main\java\FooBase.java

settings.gradle ------------------------ include ‘:foobase’, ‘:foo2’

build.gradle: ------------------ allprojects {

group = ‘org.foo’

version = ‘1.0’ } subprojects {

apply plugin: ‘java’

apply plugin: ‘maven’

repositories {

mavenCentral()

} uploadArchives {

it.repositories.mavenDeployer {

repository(url: “file:///tmp/maven-repo/”)

}

} }

project(‘proj1:proj2:foobase’) {

jar.archiveName = ‘foobase.jar’ }

project(’:foo2’) {

jar.archiveName = ‘my_foo2.jar’ }

For now I have (after gradle projects):

Root project ‘master’ ±-- Project ‘:foo2’ — Project ‘:proj1’

— Project ‘:proj1:proj2’

— Project ‘:proj1:proj2:foobase’

Question: I need only 2 project to build: foo2 and foobase. ( I don’t need proj1 and proj1\proj2 be part of the build) How I can do it?

Thank you for your help.


(Peter Niederwieser) #2
include "foobase", "foo2"
  project(":foobase").projectDir = new File(settingsDir, "proj1/proj2/foobase")

See ‘Settings’ in the Gradle Build Language Reference.