Cannot compile build script on Mac

I’m trying to run Gradle 1.1.1 on Mac OS X 10.9.1 but cannot get a simple build script to compile

Here’s the output from gradle -v

------------------------------------------------------------ Gradle 1.11 ------------------------------------------------------------

Build time:

2014-02-11 11:34:39 UTC Build number: none Revision:

a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:

1.8.6 Ant:

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

2.2.0 JVM:

1.7.0_45 (Oracle Corporation 24.45-b08) OS:

Mac OS X 10.9.1 x86_64

Here’s my build script:

apply plugin: 'java'
  sourceCompatibility = 1.7
  repositories {
   mavenCentral()
}
  dependencies {
  testCompile ‘org.testng:testng:6.8.7’
}

When I run “gradle” from the command line I get this error:

FAILURE: Build failed with an exception.

  • Where: Build file ‘/Users/frank/Documents/work/mockprogression/build.gradle’ line: 10

  • What went wrong: Could not compile build file ‘/Users/frank/Documents/work/mockprogression/build.gradle’. > startup failed:

build file ‘/Users/frank/Documents/work/mockprogression/build.gradle’: 10: expecting ‘}’, found ‘:’ @ line 10, column 26.

testCompile ‘org.testng:testng:6.8.7’

^

1 error

It looks like I’m using the correct syntax.

Why is gradle complaining about this build script ?

For your dependency declaration you are not using single or double quotes. Make sure you use the correct character.

dependencies {
    testCompile 'org.testng:testng:6.8.7'
}

Thanks for the suggestion but I still get the same problem after switching to double quotes

Seems like some sort of platform issue with Mac?

I’m just using the built in TextEdit from Mac OSX 10.9.1

apply plugin: “java”
  sourceCompatibility = 1.7
  repositories {
   mavenCentral()
}
  dependencies {
  testCompile “org.testng:testng:6.8.7”
}

Franks-MacBook-Pro:mockprogression frank$ gradle build

FAILURE: Build failed with an exception.

  • Where: Build file ‘/Users/frank/Documents/work/mockprogression/build.gradle’ line: 10

  • What went wrong: Could not compile build file ‘/Users/frank/Documents/work/mockprogression/build.gradle’. > startup failed:

build file ‘/Users/frank/Documents/work/mockprogression/build.gradle’: 10: expecting ‘}’, found ‘:’ @ line 10, column 26.

testCompile “org.testng:testng:6.8.7”

^

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: 1.998 secs Franks-MacBook-Pro:mockprogression frank$

I think TextEdit is using curly quotes instead of straight quotes http://practicaltypography.com/straight-and-curly-quotes.html (ie you are using “ instead of " and ‘ instead of ')

You might need to switch to a proper code editor

TextWrangler is free to download and seems to work better