2
votes

I added a dependency to my build.gradle: spring-data-neo4j It requires neo4j-cypher-dsl-2.0.1.jar/pom, which is only located in the repo: https://repo1.maven.org/maven2/.

However as per the output below gradle never looks at this repo for the artifact. How can I get gradle to search this repo as well.

//build.gradle
buildscript {
repositories {
    mavenCentral()
    maven {
        url "https://repo1.maven.org/maven2/"
    }
}
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.9.RELEASE")
}

}

gradle build:
FAILURE: Build failed with an exception.

What went wrong: Could not resolve all dependencies for configuration ':compile'.
Could not find org.neo4j:neo4j-cypher-dsl:2.0.1.   Searched in the following locations:
https://repo1.maven.org/maven2/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.pom

https://repo1.maven.org/maven2/org/neo4j/neo4j-cypher-dsl/2.0.1/neo4j-cypher-dsl-2.0.1.jar Required by:

  **:feedserver:1.0.0 > org.springframework.data:spring-data-neo4j:3.2.2.RELEASE**

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Edit:--------------------------------------- Sorry I accidently posted the incorrect build.gradle contents above, which has repeated maven central locations. This is my actual build.gradle file...When I build using these settings I still get the error above:

buildscript {
    repositories {
        mavenCentral()
        maven {
            url "http://m2.neo4j.org/content/repositories/releases/" 
        }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.9.RELEASE")
    }
} 
1

1 Answers

1
votes

neo4j-cypher-dsl is not in Maven central. It is available in Neo4j repository you have to add another repo something like this:

repositories {
    maven {
        url "http://m2.neo4j.org/content/repositories/releases/" 
    }
}

NOTE is not necessary to use another maven ponting to maven central using mavenCentral() is enough

EDIT 1

repositories section in buildscript just works for dependencies inside. In this case for spring-boot-gradle-plugin

buildscript {
    ext {
        springBootVersion = '1.1.9.RELEASE'
    }
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

In your case you want to add another dependencies for your project. So you need to add another repositories section out of buildscript

repositories {
    mavenLocal()
    mavenCentral()
    maven {
        url "http://m2.neo4j.org/content/repositories/releases/"
    }
}