# Gradle and Maven dependencies different

**URL:** <https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241>\
**Category:** Help/Discuss\
**Tags:** release\
**Created:** [April 21, 2015, 3:20am UTC](https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241 "2015-04-21T03:20:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhjhoo](https://avatars.discourse-cdn.com/v4/letter/y/a87d85/32.png) [@yhjhoo](https://discuss.gradle.org/u/yhjhoo)\
**Post date:** [April 21, 2015, 3:20am UTC](https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241/1 "2015-04-21T03:20:57Z")

</div>

Here is my parent POM for maven [https://github.com/yhjhoo/princeSSH/tree/master/me.princeSSH](https://github.com/yhjhoo/princeSSH/tree/master/me.princeSSH).

In maven, I can see my spring lib is 3.1.3. In gradle dependencies my spring lib become 3.2.8. Why my lib was being upgraded?

I have specified to be 3.1.3

---

<div class="post-metadata">

**Author:** ![David\_Karr](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/david_karr/32/145_2.png) [@David\_Karr](https://discuss.gradle.org/u/David_Karr)\
**Post date:** [April 21, 2015, 5:05am UTC](https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241/2 "2015-04-21T05:05:13Z")

</div>

You can compare the detailed dependency trees by doing both “mvn dependency:tree” and “gradle dependencies”. That should give you a clue.

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [April 21, 2015, 6:27am UTC](https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241/3 "2015-04-21T06:27:05Z")

</div>

> [@yhjhoo](#):
>
> In maven, I can see my spring lib is 3.1.3. In gradle dependencies my spring lib become 3.2.8. Why my lib was being upgraded?

You can use the dependency insight report to see why Gradle is choosing a particular version. My guess is you have another dependency that transitively depends on 3.2.8, in which case Gradle by default chooses the _newer_ version.

```
$ ./gradlew dependencyInsight --dependency spring-core --configuration compile

```

If you want to use 3.1.3 anyway, you can force it.

```
compile('org.springframework:spring-core:3.1.3.RELEASE') {
    force = true
}

```

---

<div class="post-metadata">

**Author:** ![yhjhoo](https://avatars.discourse-cdn.com/v4/letter/y/a87d85/32.png) [@yhjhoo](https://discuss.gradle.org/u/yhjhoo)\
**Post date:** [April 23, 2015, 3:51am UTC](https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241/4 "2015-04-23T03:51:35Z")

</div>

From the results, how shall I read it? Which configuration caused the upgrade.

---

<div class="post-metadata">

**Author:** ![mark\_vieira](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_vieira/32/5396_2.png) [@mark\_vieira](https://discuss.gradle.org/u/mark_vieira)\
**Post date:** [April 23, 2015, 4:36pm UTC](https://discuss.gradle.org/t/gradle-and-maven-dependencies-different/9241/5 "2015-04-23T16:36:13Z")

</div>

In the report you’ll see every dependency that brings in the given dependency, including transitive dependencies. Like I mentioned Gradle will chose (by default) the newest version, so any dependencies that require a newer version will force the new version to be the final resolved one. Bear in mind, there might be more than one transitive dependency that requires the newer version, so the dependency insight report will list multiple items.
