You have a typo in your build script. It's "project", not "Project". And
instead of "project.buildDir", you can simply use "buildDir".
Another mistake is that you print out the build dir in the configuration
phase instead of the execution phase. You should do this:
task show << {
println buildDir
}
Or, if you prefer:
task show {
doLast {
println buildDir
}
}
--
Peter Niederwieser
Principal Engineer, Gradleware
http://gradleware.com
Creator, Spock Framework
http://spockframework.org
Twitter: @pniederw
Luke Stephens wrote:
>
> I have the following in a build.gradle file:
>
>
> defaultTasks 'show'
>
>
> task show {
> println Project.buildDir
> }
>
> When I run it I get:
>
> * What went wrong:
> A problem occurred evaluating root project 'pojo'.
> Cause: No such property: buildDir for class: org.gradle.api.Project
>
>
> The DSL says that every build.gradle has a Project and every project has a
> property buildDir. Then why doesn't this work?
>
> BTW, I AM reading both the user guide and DSL and quite frankly there are
> things in both that don't work (such as this).
>
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Why-does-this-not-work-tp4659313p4659359.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email