Weird line number reported when there is an syntax error in build.gradle

Here is my build.gradle:

repositories {
}
  {

And then when I run gradle, it report error as:

FAILURE: Build failed with an exception.
  * Where:
Build file '/v/arena/gradle/bug/wierd_line_num/trunk/src/build.gradle' line: 119
  * What went wrong:
Could not compile build file '/v/arena/gradle/bug/wierd_line_num/trunk/src/build.gradle'.
> startup failed:
  build file '/v/arena/gradle/bug/wierd_line_num/trunk/src/build.gradle': 119: expecting '}', found '' @ line 119, column 1.
  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

It report the error is on line #119, which is apparently wrong, as my build.gradle has only 4 lines of code, I am using gradle (1.10)

Any idea?

Thanks.

Hi Balyan,

I’ve raised GRADLE-3098 for this. It happens because we append a list of default import statements to scripts.

We can use another approach that doesn’t give surprising error numbers on dangling syntax.

Thanks Luke