Gradle Build Error in STS

org.gradle.api.internal.MissingMethodException: Could not find method maven() for arguments [build_6er2uv054th2j79v5ul1li1rf0$_run_closure1_closure4@12f2b32] on root project ‘apacheparent’. Could not fetch model of type ‘HierarchicalEclipseProject’ using Gradle distribution ‘http://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-3-bin.zip’.

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'scala'
apply plugin: 'eclipse'
  repositories {
 mavenCentral()
 mavenLocal()
 maven {
  url: "http://maven.ow2.org/maven2/"
  url: "http://maven.ow2.org/maven2-snapshot/"
  url: "http://oss.sonatype.org/content/groups/public/"
  url: "http://repository.jboss.org/nexus/content/groups/public-jboss/"
  url: "http://download.java.net/maven/2/"
  url: "https://maven2-repository.dev.java.net/"
  url: "http://snapshots.repository.codehaus.org/"
  url: "http://repo1.maven.org/maven2/"
  url: "http://repo2.maven.org/maven2/"
  url: "http://repo.fusesource.com/maven2"
 }
 localRepository {
  dirs 'lib'
 }
}
  dependencies {
 compile(
  [group: 'commons-beanutils', name: 'commons-beanutils', version: '1.8.3+', ext: 'jar'],
  [group: 'commons-beanutils', name: 'commons-beanutils-bean-collections', version: '1.8.3+', ext: 'jar'],
  [group: 'commons-lang', name: 'commons-lang', version: '2.6+', ext: 'jar'],
  [group: 'org.apache.commons', name: 'commons-math', version: '2.2+', ext: 'jar']
 )
    // Libraries needed to run the scala tools
 scalaTools 'org.scala-lang:scala-compiler:2.9.1+'
 scalaTools 'org.scala-lang:scala-library:2.9.1+'
   // Libraries needed for scala api
 compile 'org.scala-lang:scala-library:2.9.1+'
    groovy group: 'org.codehaus.groovy', name: 'groovy', version: '1.7.10+'
}
  configurations {
 compile {
     }
 runtime {
     }
}

Note: the Gradle build daemon is an experimental feature. As such, you may experience unexpected build failures. You may need to occasionally stop the daemon.

FAILURE: Build failed with an exception.

  • Where: Build file ‘C:\Users\sirinath\Documents\workspace-sts-2.8.0.RELEASE\apacheparent\build.gradle’ line: 10

  • What went wrong: A problem occurred evaluating root project ‘apacheparent’. Cause: Could not find method maven() for arguments [build_6er2uv054th2j79v5ul1li1rf0$_run_closure1_closure4@f6fd54] on root project ‘apacheparent’.

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

  • Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘apacheparent’.

at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:51)

at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)

at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)

at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProjectEvaluator.java:38)

at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)

at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:71)

at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)

at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)

at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)

at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)

at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:463)

at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:458)

at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:141)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)

at org.gradle.initialization.DefaultGradleLauncher.getBuildAnalysis(DefaultGradleLauncher.java:91)

at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:42)

at org.gradle.tooling.internal.provider.DelegatingBuildModelAction.run(DelegatingBuildModelAction.java:42)

at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:56)

at org.gradle.launcher.DefaultGradleLauncherActionExecuter.execute(DefaultGradleLauncherActionExecuter.java:49)

at org.gradle.launcher.DaemonMain.build(DaemonMain.java:143)

at org.gradle.launcher.DaemonMain.doRunWithExceptionHandling(DaemonMain.java:132)

at org.gradle.launcher.DaemonMain.doRunWithLogging(DaemonMain.java:114)

at org.gradle.launcher.DaemonMain.doRun(DaemonMain.java:94)

at org.gradle.launcher.DaemonMain.access$000(DaemonMain.java:45)

at org.gradle.launcher.DaemonMain$1.handle(DaemonMain.java:75)

at org.gradle.launcher.DaemonConnector$1.execute(DaemonConnector.java:165)

at org.gradle.launcher.DaemonConnector$1.execute(DaemonConnector.java:161)

at org.gradle.messaging.remote.internal.TcpIncomingConnector$Receiver.run(TcpIncomingConnector.java:102)

at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:63) Caused by: org.gradle.api.internal.MissingMethodException: Could not find method maven() for arguments [build_6er2uv054th2j79v5ul1li1rf0$_run_closure1_closure4@f6fd54] on root project ‘apacheparent’.

at org.gradle.api.internal.AbstractDynamicObject.methodMissingException(AbstractDynamicObject.java:60)

at org.gradle.api.internal.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:56)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:106)

at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)

at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.groovy:68)

at build_6er2uv054th2j79v5ul1li1rf0$_run_closure1.doCall(C:\Users\sirinath\Documents\workspace-sts-2.8.0.RELEASE\apacheparent\build.gradle:10)

at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:61)

at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:31)

at org.gradle.api.internal.project.AbstractProject.repositories(AbstractProject.java:889)

at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)

at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)

at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)

at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.groovy:68)

at build_6er2uv054th2j79v5ul1li1rf0.run(C:\Users\sirinath\Documents\workspace-sts-2.8.0.RELEASE\apacheparent\build.gradle:7)

at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:49)

… 29 more

BUILD FAILED

Total time: 11.819 secs

Looks like you are using 1.0-milestone-3. The maven(Closure) method was added in 1.0-milestone-5.

How to add repositories in this version

I changed to M5 but still getting the same

The correct syntax is:

repositories {
  maven {
    url "http://maven.ow2.org/maven2/"
  }
  maven {
    url "http://maven.ow2.org/maven2-snapshot/"
  }
  ...
}

In other words: A separate “maven” block for each URL, and no colon after “url”.

thanks