Use of mavenCentral in buildScript gives warning

Hi

If I add

buildscript {

repositories {

mavenCentral()

}

dependencies {

classpath ‘com.google.guava:guava:10.0.1’

} }

I get this warning:

The ‘urls’ property of the RepositoryHandler.mavenRepo() method is deprecated and will be removed in a future version of Gradle. You should use the ‘url’ property to define the core maven repository & the ‘artifactUrls’ property to define any additional artifact locations.

What’s the correct way to add mavenCentral to the buildscript repositories?

/Jeppe

This smells like some cached (outdated) buildscript. You should not get that warning with mavenCentral(). Have you tried adding the “–recompile-scripts” command line option?

Just tried, no change.

Note that using mavenCentral() in “normal” project dependencies doesn’t give the warning. It’s only when used in the buildscript{} context.

You are already doing it correctly. I can’t reproduce the deprecation warning, works just fine for me. Do you maybe have an ‘init.gradle’ in your Gradle user home that interferes here? What’s the output of ‘gradle -v’?

./gradlew -v

------------------------------------------------------------ Gradle 1.0-rc-3 ------------------------------------------------------------

Gradle build time: Sunday, April 29, 2012 11:51:52 PM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_31 (Apple Inc. 20.6-b01-415) OS: Mac OS X 10.6.8 x86_64

I tried “rm -rf ~/.gradle” but still get it. Here’s the first lines of output

rm -rf ~/.gradle ./gradlew clean test

Downloading http://services.gradle.org/distributions/gradle-1.0-rc-3-bin.zip … Unzipping /Users/jeppe/.gradle/wrapper/dists/gradle-1.0-rc-3-bin/59nkhr3nl96fm3u00sr182b0pj/gradle-1.0-rc-3-bin.zip to /Users/jeppe/.gradle/wrapper/dists/gradle-1.0-rc-3-bin/59nkhr3nl96fm3u00sr182b0pj Set executable permissions for: /Users/jeppe/.gradle/wrapper/dists/gradle-1.0-rc-3-bin/59nkhr3nl96fm3u00sr182b0pj/gradle-1.0-rc-3/bin/gradle Download http://repo1.maven.org/maven2/com/google/guava/guava/10.0.1/guava-10.0.1.pom Download http://repo1.maven.org/maven2/com/google/guava/guava-parent/10.0.1/guava-parent-10.0.1.pom Download http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom Download http://repo.smokejumperit.com/com/smokejumperit/gradle-plugins/0.8.2/gradle-plugins-0.8.2.pom Download http://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.pom Download http://repo1.maven.org/maven2/org/apache/commons/commons-parent/17/commons-parent-17.pom Download http://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.pom Download http://repo1.maven.org/maven2/com/google/guava/guava/10.0.1/guava-10.0.1.jar Download http://repo.smokejumperit.com/com/smokejumperit/gradle-plugins/0.8.2/gradle-plugins-0.8.2.jar Download http://repo1.maven.org/maven2/commons-lang/commons-lang/2.6/commons-lang-2.6.jar Download http://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar The ‘urls’ property of the RepositoryHandler.mavenRepo() method is deprecated and will be removed in a future version of Gradle. You should use the ‘url’ property to define the core maven repository & the ‘artifactUrls’ property to define any additional artifact locations. Download http://repo1.maven.org/maven2/net/java/dev/jets3t/jets3t/0.8.0/jets3t-0.8.0.pom Download http://repo1.maven.org/maven2/com/google/code/typica/typica/1.7.2/typica-1.7.2.pom Download http://repo1.maven.org/maven2/org/codehaus/groovy/modules/http-builder/http-builder/0

Since you are running ‘gradlew clean test’, your build script must contain more than what you showed. Have you tried with just the build script you showed? The problem is very likely related to your particular environment (e.g. a plugin that you apply, or an ‘init.gradle’ in your user home).

Ahh yes of course :slight_smile:

If I remove

apply {

plugin com.smokejumperit.gradle.RunJRubyPlugin }

the warning disappears.

Sorry for the noise…