Hello there! First and foremost, I’m bloodily new to Gradle, so I do feel like I’m pretty stumped with basic knowledge. Sorry for that.
In any case, I’m currently trying to learn how to write custom task types. For that, I’ve tried to follow this guide. No problem here when I directly included that as a normal task in my main build.gradle:
task mytask(type: MyCustomTask) {
somestring = 'hello'
}
class MyCustomTask extends DefaultTask {
String somestring = 'goodbye'
@TaskAction
def run() {
println somestring
}
}
As expected, executing gradle mytask prints “Hello” just fine.
However, the general idea I’m pursuing is obviously a reusable plugin that could be applied to a number of existing projects. The guide I’ve linked gets pretty confusing at 38.3. I’ve never specified a group, name, or version for that matter, so I got no idea how to properly export MyCustomTask.