Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8012781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:26:10+00:00 2026-06-04T19:26:10+00:00

When there is a conflict in the dependency tree (same artifact but different versions)

  • 0

When there is a conflict in the dependency tree (same artifact but different versions) then, AFAIK, Maven will resolve the conflict by selecting the highest version of the dependency and will omit the ‘old’ ones.

However, when the newer version is a SNAPSHOT then apparently it will choose the older stable version over the SNAPSHOT.

In my case: some-artifact: 0.5.0-SNAPSHOTS (omitted for conflict with 0.4.0) => version 0.4.0 is picked over the wanted 0.5.0-SNAPSHOT.

I assume this functions as designed but I don’t understand the reason why. Next to that, any idea if there is a way to tell Maven to take the SNAPSHOT over the stable version?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:26:11+00:00Added an answer on June 4, 2026 at 7:26 pm

    Your assumption about Maven’s always selecting the highest version isn’t accurate. Artifacts are chosen based on a number of factors including depth of the dependency in the tree, order in the tree, whether the dependency is a snapshot or a release, and dependency management, which pretty much overrides everything else.

    Unfortunately, I don’t know of any one, definitive source of information on Maven’s dependency resolution algorithms. You’ll find bits and pieces of it scattered all over. A few handy references:

    • Introduction to the Dependency Mechanism gives an overview of the topic with a good, if short, section on Transitive Dependencies and how they’re selected from a dependency tree.
    • The Sonatype Maven book has a more thorough section on Project Dependencies in general that will add a lot to your knowledge about the subject.
    • An earlier section of that same book discusses Project Versions, which is strongly related to this problem and has a good section on SNAPSHOT versions, though not as much as I could wish on how they play into dependency resolution.
    • Project Relationships talks about the coordinate system and how project inheritance affects what dependencies get included.
    • Finally, the POM Reference is a good jumping-off point for almost anything to do with the pom. There’s at least a brief description of every pom element that can help you understand enough to be able to begin searching for more info effectively.

    As for some practical advice, the output of mvn dependency:tree is highly useful in discovering why a particular version of a dependency was chosen. It’ll often even tell you something like “foo:bar:1.2 (was 1.1)”. Once you figure out where the errant version is coming from, there are a number of ways to ensure a specific dependency version is used for a project:

    • Exclude wrongly-versioned dependencies from other dependencies that are causing them to be included in the build.
    • Add an explicit top-level dependency to your pom instead of relying on a transitive dependency.
    • List the dependency in the dependencyManagement section of your pom (scroll down a bit from this link) to force the dependency to have the specified characteristics, regardless of what level of transitive dependency it is. Use this option with care, as dependencyManagement is viral, in that other projects depending on your project will be “infected” with your dependency management. There’s also a good section on dependency management in the pom reference.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Will there any conflict while creating temporary tables of Same name in MySql from
I have to use mootools and jquery files together. But there is a conflict
I just wonder whether there will be any conflict if two service intents are
If a page has both JQuery and Prototype then I got conflict. There is
I am trying to use Lightbox plugin but with jquery there is a conflict
Is there an easy way to check what is the reason of dependency conflict
I can easily see if there are conflicts between (transitive) dependency versions using: mvn
I have been in toruble with kind of conflict issue. There is a Database
Or there will be some conflicts ?
I like to distinguish three different types of conflict from a version control system

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.