Problem in Using Multiple Maven Repositories in Gradle

The following code give an error:

apply plugin: 'java'
  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"
 }
}

Care to share the error message?

Error configuring classpath container.

I am using Gradle within SpringSource Tool Suite.

That’s still not the full error message.

Your ‘maven()’ block is wrong.

It should be:

maven {
  url "http://maven.ow2.org/maven2/"
  // …
}

Plus, only one url per maven { } block:

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

I think most of the URLs you have listed are replicated at maven central anyway, so you can leave most them out, given that you have ‘mavenCentral()’ included.

Using AndroidStudio, the code inspector flagged this issue in my build.gradle file (using the syntax adapted from the above example):

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

which gradle 1.10 utilizes without an issue from the command line.

I could not find documentation to verify if this was now an acceptable to have multiple urls in a maven block (and the search engine querying brought me here).

This will just overwrite the repository’s URL, and the last line will win. If it gets flagged, that’s good.

That’s helpful - thank you.

I’ve tried this but it doesn’t seem to pickup the second maven block package com.xxx.yyy does not exist

maven {

url ‘http://abcd.com/artifactory/coms-release

}

maven {

url ‘http://abcd.com/artifactory/libs-release

}

Gradle version is 2.3