How can I pass properties to gradle custom task? In ant It will look like this:

public class MyCustomTask extends Task {

    private String name;
    private String version;

    @Override
    public void execute() throws BuildException {
        // do the job
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setVersion(String version) {
        this.version = version;
    }

}

How to do it in gradle?

class MyCustomTask extends DefaultTask {

    private String name
    private String version

    @TaskAction
    def build() {
        // do the job
    }

}

Properties name and version are required and user needs to pass them to task.

Edit
Report