仅从 gradle 文件导入一项任务
Importing only one task from gradle file
我说得对吗,没有办法从脚本文件中只导入一个 task
到项目中?我有实用程序 task
,它应该在任务列表中。
task utiliyTask{
description 'Utility task which you could to run when you need it'
funA()
funB()
}
def funA(){
//...
}
def funB(){
//...
}
将 apply from
放入项目的 build.gradle
文件中会自动执行此任务,这是错误的。我找到的唯一解决方案是 creating plugin,但为 100 行实用程序脚本
创建一个插件似乎有些矫枉过正
解决办法就是简单的在doLast
中添加任务执行代码
task utiliyTask{
description 'Utility task which you could to run when you need it'
doLast {
funA()
funB()
}
}
我说得对吗,没有办法从脚本文件中只导入一个 task
到项目中?我有实用程序 task
,它应该在任务列表中。
task utiliyTask{
description 'Utility task which you could to run when you need it'
funA()
funB()
}
def funA(){
//...
}
def funB(){
//...
}
将 apply from
放入项目的 build.gradle
文件中会自动执行此任务,这是错误的。我找到的唯一解决方案是 creating plugin,但为 100 行实用程序脚本
解决办法就是简单的在doLast
task utiliyTask{
description 'Utility task which you could to run when you need it'
doLast {
funA()
funB()
}
}