How do i can call more than one gradle scripts into other gradle script
I am converting ant script to gradle.I have change following
<ant antfile="build.xml"
target="clean"/>
task buildclean(type: GradleBuild)<< {
buildFile ='build.gradle'
tasks['clean']
}
task buildelocket(type: GradleBuild)<< {
buildFile ='bussniess/build.gradle'
tasks['elocket']
}
this gradle script is calling three more other gardle scripts.When i called开发者_如何转开发 buildclean task from other task under same gradle script it is not working properly
task callingtasks <<{
tasks.buildclean.excute()
tasks.buildelocket.excute()
}
How do i can call more than one gradle scripts into other gradle script
I think there are two issues with your build scripts:
remove the "<<" in the buildclean and buildelocket task. << is a shortcut for doLast{} but buidfile and task property of tasks of type GradleBuild should be set in configurationphase not during execution phase:
task buildclean(type: GradleBuild) { buildFile ='build.gradle' tasks << 'clean' } task buildelocket(type: GradleBuild){ buildFile ='bussniess/build.gradle' tasks << 'elocket' }
For a number of reasons you should avoid executing tasks explicitly via execute(). Try
task callingtasks(dependsOn: ['buildclean', 'buildelocket']){ }
精彩评论