Reputation: 1241
How can I mention subproject should build before root project.
in settings.gradle
rootProject.name = 'loginmodule'
include 'servicebundle'
include 'webbundle'
include 'webredirectbundle'
When I try this build dependson subprojects:build
it is giving error like circular dependency.
Currently in my root project build.gradle
is bundling all subprojects like below
task createESA(type: Zip, dependsOn: generateSubSystemFile) {
subprojects.each { dependsOn("${it.name}:build") }
from subprojects.collect { "${it.buildDir}/libs" }
from (subsystemFile) {
into 'OSGI-INF'
}
from ('resources/OSGI-INF') {
into 'OSGI-INF'
}
baseName project.name
extension 'esa'
}
build.finalizedBy createESA
I am using gradle clean build
to build the project.
Is there any better way to do that ?? I just want to build all subprojects first before root project build.
Upvotes: 2
Views: 2917
Reputation: 59709
Have your createESA
task depend on subprojects*.build
, it'll say that task can't run until all of the build
tasks in all of the subprojects have run. Then, declare that the root project's build
task depends on createESA
.
task createESA(type: Zip, dependsOn: subprojects*.build) {
// etc...
}
build.dependsOn createESA
Upvotes: 1