subprojects {
apply plugin: "java"
repositories {
mavenCentral()
}
dependencies {
testCompile "junit:junit:4+"
}
}
//Common Project specific stuff
project(':common') {
dependencies {
compile 'org.apache.commons:commons-lang3:3.3.2'
}
}
//API Project specific stuff
project(':api') {
dependencies {
compile project(':common')
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'log4j:log4j:1.2.17'
}
}
//App Project specific stuff
project(':app') {
dependencies {
compile project(':common'), project(':api')
compile 'log4j:log4j:1.2.17'
}
}
// build.gradle
allprojects {
task hello << { task -> println "I'm $task.project.name" }
}
subprojects {
//Some other stuff (Empty for now)
}
//API Project specific stuff
project(':api') {
}
//Common Project specific stuff
project(':common') {
apply plugin: "java"
repositories {
mavenCentral()
}
}
//App Project specific stuff
project(':app') {
}
// build.gradle
allprojects {
task hello << { task -> println "I'm $task.project.name" }
}
subprojects {
apply plugin: "java"
repositories {
mavenCentral()
}
}
// $ gradle api:build
// build.gradle
allprojects {
//Put instructions for all projects
}
subprojects {
//Put instructions for each sub project
}
To understand what is happening, update your build.gradle file in the root folder i.e. e:\javaprojects to contain the following:
allprojects {
task hello << { task -> println "I'm $task.project.name" }
}
subprojects {
}
// $ gradle -q hello
// settings.gradle
include ":api", ":common", ":app"