1 year ago
#385916
Sachin Naik
Gradle task in configuratoin phase has dependency on a task in execution phase
i have 3 different build files,
prodbuild.gradle, build.gradle and build.xml
and the hierarchy is, i will first call prodbuild.gradle
// Script used by Prod builds,
// Import development gradle file for basic build
apply from: 'build.gradle'
task prodX {
...
}
task prodY {
...
}
task prodZ {
...
}
as per my understanding this is calling build.gradle
ant.importBuild('build.xml')
task A {
...
}
task B {
...
}
and this is calling build.xml
<target name="antX" >
...
...
</target>
<target name="antY" dependson "antX">
...
...
</target>
Problem statement
target antX uses the directory created by task B in build.gradle, but the line
ant.importBuild('build.xml')
is executed in configuration phase, and at that time task A and task B are not executed, this is causing the issue,
i tried to avoid this by changing the build.gradle as
task importAntBuild (){
doLast {
ant.importBuild('build.xml')
}
}
but task prodX is dependent on target antY, since i made importAntBuild to run at last this will again cause the problem.
this is the first time i am working on a gradle project, correct me if my understanding is wrong, any help is appreciated.
PS : all of this cycle was working fine with gradle 2.3, this issue is observed after i upgraded it to gradle 7.4
java
gradle
build
build.gradle
lifecycle
0 Answers
Your Answer