Gradle: Compile Dependencies

I'm using mongodb with Spring Boot. Recently, my mongodb was upgraded to version 3.0.

I'm using the following Gradle dependencies for Spring:

buildscript {
    ext {
        springBootVersion = '1.2.6.RELEASE'

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-data-mongodb'

If I look on maven repositories for Gradle: 'org.springframework.boot:spring-boot-starter-data-mongodb:1.2.6.RELEASE', I see the following (

The dependencies for the mongo-java-drivers are 2.12.5 under the "Version" column. I was wondering what the "Update" column is there for and how can I use the version of the mongo-java-drivers listed there instead (3.0.4)?

Since I'm using mongo 3.0, I would like to use the 3.0.4 java-drivers instead of 2.12.5 as I need to update my java-drivers to be at least 2.13 before they will work with my mongodb 3.0:


Just add the following dependency to your project dependencies:

compile 'org.mongodb:mongo-java-driver:3.0.4'

This will explicitly set there mongodb Java driver to the newest version and will overrun the transitive dependency version of spring-boot-starter-data-mongodb.

BTW, the "Updates" column means the newest version for a specific Artifact.

You can force the usage of a newer version of a dependency by just explicitly adding the dependency version that you want to use in the pom.xml. Then Maven will use the explicitly specified version to compile.

FYI, you can exclude a dependency triggered by a direct dependency by using the exclude element.

See this doc to know how maven manages dependencies.

If you are using Gradle, see this page. In fact, you exclude the MongoDB transitive dependency triggered by spring boot and you explicitly add the latest version as a direct dependency.

Need Your Help

Converting the request to an array in Facebook PHP sdk

php facebook-graph-api

$user = $request->getGraphObject->asArray();

No generic implementation of OrderedDictionary?

c# .net generics .net-4.0 ordereddictionary

There doesn't appear to be a generic implementation of OrderedDictionary (which is in the System.Collections.Specialized namespace) in .NET 3.5. Is there one that I'm missing?