filmov
tv
Exploring How To Write Custom Gradle Tasks

Показать описание
Gradle is a build tool for Java and other JDK based projects that uses a series of tasks to compile, test and run your projects. One of the advantages of Gradle being based upon tasks instead of specific features is that it is very extensible. This means different tools can add more features to the project as needed (for example a linter can create a `gradle lint` task). It also means *we* can add more features to our projects by creating our own custom tasks.
In this video we're going to explore the basics of creating a new gradle project with `gradle init` and then adding a new custom task that can print information to our terminal or run a custom command line tool.
To register a basic task named `hello` in Gradle you could use. This task will print out a cool cat:
```groovy
def kitty = """ /\\____/\\ __
.' \"\"\"\" `,-' `--.__
__,- : - - ; " :: `-. -.__
,-sssss `._ `' _,'" ,'~~~::`.sssss-.
|ssssss ,' ,_`--'_ __,' :: ` `.ssssss|
|sssssss `-._____~ `,,'_______,---_;; ssssss|
|ssssssssss `--'~{__ ____ ,'ssssss|
`-ssssssssssssssssss ~~~~~~~~~~~~ ssss.-'
println kitty
}
```
In this video we're going to explore the basics of creating a new gradle project with `gradle init` and then adding a new custom task that can print information to our terminal or run a custom command line tool.
To register a basic task named `hello` in Gradle you could use. This task will print out a cool cat:
```groovy
def kitty = """ /\\____/\\ __
.' \"\"\"\" `,-' `--.__
__,- : - - ; " :: `-. -.__
,-sssss `._ `' _,'" ,'~~~::`.sssss-.
|ssssss ,' ,_`--'_ __,' :: ` `.ssssss|
|sssssss `-._____~ `,,'_______,---_;; ssssss|
|ssssssssss `--'~{__ ____ ,'ssssss|
`-ssssssssssssssssss ~~~~~~~~~~~~ ssss.-'
println kitty
}
```
Комментарии