Can't run the Hello World!-example, build fails with cannot find dolast() for arguments

Running the first hello world example in the online installation tutorial (http://www.gradle.org/docs/current/userguide/tutorial_using_tasks.html) the build fails with “Could not find method dolast() for arguments [build_3j5djcu6u9fre9vqmqpvdsbt4c$_run_closure1_closure2@3219ab8d] on root project”

Any clues would be grateful!

thanks in advance,

PO

task hello {
 dolast{
  println "Hello World!"
 }
}

$ gradle -v ------------------------------------------------------------ Gradle 1.10 ------------------------------------------------------------

Build time:

2013-12-17 09:28:15 UTC Build number: none Revision:

36ced393628875ff15575fa03d16c1349ffe8bb6

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.6.0_65 (Apple Inc. 20.65-b04-462) OS:

Mac OS X 10.9.1 x86_64

The method name of doLast has a capital letter “L”. You lower-cased the method name.

task hello {
    doLast {
        println "Hello World!"
    }
}

Debug log found here http://pastebin.com/download.php?i=FDMWjkhh

I just posted the solution above.

Thanks.

However, the example still does not succeed when using the command in the doc:

gradle -q hello:

Project ‘hello’ not found in root project ‘projname’

When I do gradle -q hello

it works fine?!

If you are referring to the ‘hello’ task in the root project which you do in your case, the colon character (:slight_smile: has to come first. You have to call it like this: ‘gradle -q :hello’.

In the sentence of the user guide, the colon is actually not part of the command.