How to execute method in class using Gradle task?

Viewed 121

I want to execute Hello method in class using gradle task(at springboot). The sample is like below.

class MyClass
{
    public void Hello()
    {
        System.out.println("Hello World");
    }
}

Is there any way to execute Hello function in gradle task?

I had added below and tried but below task cannot parse MyClass token.

task myTest{
    doLast {
        println "Executing MyClass method"
        def v = new MyClass();
        v.Hello();
    }
}
0 Answers
Related