How to write and call methods in gradle script

As mentioned in our previous post where we discussed the flow of a gradle custom task, we will now talk about how we can define a custom method inside the Gradle script so that we can arrange our coding for a better understanding.

In one approach of writing methods are given below:

ext.myCustomMethod = {  parameter_1, parameter_2 ->

   <logic>

}

The above declaration of method will be globally available along the project.

Read the rest

How to write a gradle task in your build.gradle to do a custom job

How to write a gradle task in your build.gradle to do a custom job

As you already know, gradle is a project automation tool based on the concepts and methods of  Apache Ant and Apache Maven contains the good aspects of both and it provides a way to implement your own build idea. Unlike ant or maven that uses xml to configure things, gradle uses a groovy based Domain Specific Language (DSL) to write your build logic.

Read the rest