Can't even run the first two tutorial examples


(Sean Gilkey) #1

On Mountain Lion, I’ve tried both Gradle 1.4 and 1.5-rc-1 and cannot successfully execute even the simplest tutorial build. I looked for my error messages in these fora and on Google and have found nothing that helps. For each version, I grabbed a fresh download from http://www.gradle.org/downloads. I unzipped it with tar to silence the useless suggestion that the Mac archive utility doesn’t maintain the correct file permissions. I unset my Java CLASSPATH to prevent any chance of conflicting jars. I deleted the leftover .gradle directory from each previous attempt so that my gradle commands appeared to be the very first one ever. I’m at a loss. Here’s my console

[kaffn8ed ~]$ echo $CLASSPATH [kaffn8ed ~]$ cat build.gradle task hello {

doLast {

println ‘Hello, World!’

} }

[kaffn8ed ~]$ /Users/kaffn8ed/Downloads/gradle-1.5-rc-1/bin/gradle hello

FAILURE: Build failed with an exception.

  • Where: Build file ‘/Users/kaffn8ed/build.gradle’ line: 1

  • What went wrong: A problem occurred evaluating root project ‘kaffn8ed’. > Could not find property ‘task’ on root project ‘kaffn8ed’.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.771 secs [kaffn8ed ~]$ cd other [kaffn8ed ~/other]$ cat build.gradle task hello << {

println ‘Hello, World!’ }

[kaffn8ed ~/other]$ /Users/kaffn8ed/Downloads/gradle-1.5-rc-1/bin/gradle hello

If there’s any help out there, I sure do need it.

FAILURE: Build failed with an exception.

  • Where: Build file ‘/Users/kaffn8ed/other/build.gradle’ line: 1

  • What went wrong: Could not compile build file ‘/Users/kaffn8ed/other/build.gradle’. > startup failed:

build file ‘/Users/kaffn8ed/other/build.gradle’: 1: expecting EOF, found ‘hello’ @ line 1, column 6.

task hello << {

^

1 error

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.231 secs


(Peter Niederwieser) #2

It’s likely an environment problem. Maybe your build scripts contain unprintable characters. What does ‘gradle -v’ give?

I unzipped it with tar to silence the useless suggestion that the Mac archive utility doesn’t maintain the correct file permissions.

The user guide warns about the fact that some unarchivers on Mac don’t get file permissions right. I’ve never seen this in practice, but if you get these warnings, I recommend to try with another unarchiver.


(Sean Gilkey) #3

[kaffn8ed~]$ /Users/kaffn8ed/Downloads/gradle-1.5-rc-1/bin/gradle --version

------------------------------------------------------------ Gradle 1.5-rc-1 ------------------------------------------------------------

Gradle build time: Monday, March 11, 2013 11:50:19 AM UTC Groovy: 1.8.0 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.7.0_04 (Oracle Corporation 23.0-b21) OS: Mac OS X 10.8.2 x86_64


(Peter Niederwieser) #4

Did you try with a different unarchiver that doesn’t give any warnings?


(Peter Niederwieser) #5

Your Gradle installation is using the wrong Groovy version - 1.8.0 instead of 1.8.6 (only the latter ships with Gradle). My best bet is that you have installed Groovy 1.8.0 in a central location like your JRE’s ext/lib directory.