Not able to run gradle

I’m trying to run my first gradle example.
I created build.gradle file:

task hello {
    doLast {
        println 'Hello world!'
    }
}

I run the script: gradle -q hello
and I’m getting an error:

FAILURE: Build failed with an exception.

someone can assist?

Which version of Gradle are you using? Can you run without -q and with -s and post the stacktrace?