SimZhou
SimZhou

Reputation: 555

Solving the inconsistent dependency location in Gradle

So I am building a gradle project, here's my (simplified) build script:

buildscript {
    repositories {
        maven { url "https://repo1.maven.org/maven2/" }
        maven { url 'https://repo.spring.io/plugins-release-local/' }
    }
    dependencies {
        classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.2.4'
    }
}

This gives me error:

   > Could not find org.apache.xerces:xercesImpl:2.9.1.
     Searched in the following locations:
       - https://repo1.maven.org/maven2/org/apache/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom
       - https://repo.spring.io/plugins-release-local/org/apache/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom
     Required by:
         project : > org.springframework.build.gradle:docbook-reference-plugin:0.2.4

Apparently docbook requires xerces as a dependency.

So I searched for xerces in maven repository, found xerces not in org/apache/xerces/ but in xerces/!!! (wtf!?) (see https://repo1.maven.org/maven2/xerces/xercesImpl/2.9.1/)

So now, how should I let gradle know that when searching for the xerces for docbook, it should go to xerces/ instead of org/apache/xerces/?

Upvotes: 0

Views: 596

Answers (2)

Igor Kanshyn
Igor Kanshyn

Reputation: 912

Try to extend your set of repositories with

mavenLocal()
mavenCentral()

Defining URLs of repositories are not needed, except cases where you are in a corporate environment where internet access is restricted.

Upvotes: 0

smac89
smac89

Reputation: 43068

According to the Github page for that plugin, looks like the correct repository is:

repositories {
    maven { url 'http://repo.spring.io/plugins-release' }
}

And indeed, it contains the artifact

Previous answer

Try adding mavenCentral() to the list of repositories

repositories {
    mavenCentral()
    maven { url "https://repo1.maven.org/maven2/" }
    maven { url 'https://repo.spring.io/plugins-release-local/' }
}

Upvotes: 1

Related Questions