I have the following structure for my flat multi project build:
this is my root project:
neotip_root_gradle
…build.gradle
…settings.gradle
neotip_common
…build.gradle
neotip_data
…build.gradle
neotip_view
…build.gradle
[settings.gradle]
include “neotip_common”, “neotip_data”, "neotip_view"
project(’:neotip_common’).projectDir = new File(’…/neotip_common’)
project(’:neotip_data’).projectDir = new File(’…/neotip_data’)
project(’:neotip_view’).projectDir = new File(’…/neotip_view’)
=============================
neotip_root_gradle: build.gradle
//only a println
neotip_common: build.gradle
task buildALL << {
tasks.buildCOMMON.execute()
println “zCompleted ‘buildALL’ for $project”
}
assemble.mustRunAfter clean
task buildCOMMON (dependsOn: [‘clean’, ‘assemble’]) << {
println “zCompleted ‘buildCOMMON’ for $project”
}
neotip_data: build.gradle
task buildALL (dependsOn: ‘:neotip_common:buildALL’) << {
tasks.buildDATA.execute()
println “zCompleted ‘buildALL’ for $project”
}
assemble.mustRunAfter clean
task buildDATA (dependsOn: [‘clean’, ‘assemble’]) << {
println “zCompleted ‘buildDATA’ for $project”
}
neotip_view: build.gradle
task buildALL (dependsOn: ‘:neotip_data:buildALL’) << {
tasks.buildVIEW.execute()
println “zCompleted ‘buildALL’ for $project”
}
assemble.mustRunAfter clean
task buildVIEW (dependsOn: [‘clean’, ‘assemble’]) << {
println “zCompleted ‘buildVIEW’ for $project”
}
=============================
when I call buildall from the root project. it finds all sub projects but it ignores the java plugin tasks [clear, assemble].
C:…\neotip_root_gradle>gradlew buildall
:neotip_common:buildALL
zCompleted ‘buildCOMMON’ for project ':neotip_common’
zCompleted ‘buildALL’ for project ‘:neotip_common’
:neotip_data:buildALL
zCompleted ‘buildDATA’ for project ':neotip_data’
zCompleted ‘buildALL’ for project ‘:neotip_data’
:neotip_view:buildALL
zCompleted ‘buildVIEW’ for project ':neotip_view’
zCompleted ‘buildALL’ for project ‘:neotip_view’
BUILD SUCCESSFUL
but when I change the tasks to:
neotip_common: build.gradle
task buildALL (dependsOn: [‘clean’, ‘assemble’]) << {
println “zCompleted ‘buildALL’ for $project”
}
neotip_data: build.gradle
task buildALL (dependsOn: [’:neotip_common:buildALL’, ‘clean’, ‘assemble’]) << {
println “zCompleted ‘buildALL’ for $project”
}
neotip_view: build.gradle
task buildALL (dependsOn: [’:neotip_data:buildALL’, ‘clean’, ‘assemble’]) << {
println “zCompleted ‘buildALL’ for $project”
}
now, run it again
C:…\neotip_root_gradle>gradlew buildall
:neotip_common:clean
:neotip_common:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:neotip_common:processResources UP-TO-DATE
:neotip_common:classes
:neotip_common:jar
:neotip_common:assemble
:neotip_common:buildALL
zCompleted ‘buildALL’ for project ‘:neotip_common’
:neotip_data:clean
:neotip_data:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:neotip_data:processResources UP-TO-DATE
:neotip_data:classes
:neotip_data:jar
:neotip_data:assemble
:neotip_data:buildALL
zCompleted ‘buildALL’ for project ‘:neotip_data’
:neotip_view:clean
:neotip_view:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
47 warnings
:neotip_view:processResources UP-TO-DATE
:neotip_view:classes
:neotip_view:jar
:neotip_view:assemble
:neotip_view:buildALL
zCompleted ‘buildALL’ for project ‘:neotip_view’
BUILD SUCCESSFUL
works like a charm,
can any one explain to me why the tasks…execute() ignores the dependson for the java plugin tasks.
thank you very much