我的自定义gradle插件如下
package my.own.gradle
import org.gradle.api.*
class GroovinPlugin implements Plugin<Project> {
void apply(Project project) {
project.extensions.create("groovin", GroovinPluginExtension)
project.task('groove') << {
println project.groovin.message
}
}
}
class GroovinPluginExtension {
def String message = 'We be groovin\''
}
根据example。我收到了警告:
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
我该怎么办?
答案 0 :(得分:1)
需要将<<
更改为doLast
,如下所示
package my.own.gradle
import org.gradle.api.*
class GroovinPlugin implements Plugin<Project> {
void apply(Project project) {
project.extensions.create("groovin", GroovinPluginExtension)
project.task('groove') {
doLast {
println project.groovin.message
}
}
}
}
class GroovinPluginExtension {
def String message = 'We be groovin\''
}