How does Maven resolve dependency conflicts?
Let's assume we have a Project A.
- Project A has a dependency on Project B version 1.0
- Project A has a dependency on Project C version 2.0
- Project C (version 2.0) has a dependency on Project B version 2.0
In this case, how would Maven resolve the conflict?
maven
add a comment |
Let's assume we have a Project A.
- Project A has a dependency on Project B version 1.0
- Project A has a dependency on Project C version 2.0
- Project C (version 2.0) has a dependency on Project B version 2.0
In this case, how would Maven resolve the conflict?
maven
I'm not satisfied the question. According to stackoverflow.com/help/how-to-ask, you should "Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself." I don't see any dififculties to prevent solve issue yourself.
– michaldo
Aug 10 '16 at 8:14
Is this a multi module build?
– khmarbaise
Aug 10 '16 at 8:22
@khmarbaise no. I have project B and project C as a dependency in the pom.xml of project A.
– erolkaya84
Aug 10 '16 at 8:26
add a comment |
Let's assume we have a Project A.
- Project A has a dependency on Project B version 1.0
- Project A has a dependency on Project C version 2.0
- Project C (version 2.0) has a dependency on Project B version 2.0
In this case, how would Maven resolve the conflict?
maven
Let's assume we have a Project A.
- Project A has a dependency on Project B version 1.0
- Project A has a dependency on Project C version 2.0
- Project C (version 2.0) has a dependency on Project B version 2.0
In this case, how would Maven resolve the conflict?
maven
maven
edited Nov 22 '18 at 23:38
Chris Halcrow
11.1k46990
11.1k46990
asked Aug 10 '16 at 8:06
erolkaya84erolkaya84
9441219
9441219
I'm not satisfied the question. According to stackoverflow.com/help/how-to-ask, you should "Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself." I don't see any dififculties to prevent solve issue yourself.
– michaldo
Aug 10 '16 at 8:14
Is this a multi module build?
– khmarbaise
Aug 10 '16 at 8:22
@khmarbaise no. I have project B and project C as a dependency in the pom.xml of project A.
– erolkaya84
Aug 10 '16 at 8:26
add a comment |
I'm not satisfied the question. According to stackoverflow.com/help/how-to-ask, you should "Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself." I don't see any dififculties to prevent solve issue yourself.
– michaldo
Aug 10 '16 at 8:14
Is this a multi module build?
– khmarbaise
Aug 10 '16 at 8:22
@khmarbaise no. I have project B and project C as a dependency in the pom.xml of project A.
– erolkaya84
Aug 10 '16 at 8:26
I'm not satisfied the question. According to stackoverflow.com/help/how-to-ask, you should "Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself." I don't see any dififculties to prevent solve issue yourself.
– michaldo
Aug 10 '16 at 8:14
I'm not satisfied the question. According to stackoverflow.com/help/how-to-ask, you should "Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself." I don't see any dififculties to prevent solve issue yourself.
– michaldo
Aug 10 '16 at 8:14
Is this a multi module build?
– khmarbaise
Aug 10 '16 at 8:22
Is this a multi module build?
– khmarbaise
Aug 10 '16 at 8:22
@khmarbaise no. I have project B and project C as a dependency in the pom.xml of project A.
– erolkaya84
Aug 10 '16 at 8:26
@khmarbaise no. I have project B and project C as a dependency in the pom.xml of project A.
– erolkaya84
Aug 10 '16 at 8:26
add a comment |
2 Answers
2
active
oldest
votes
It'd build with Project B v 1.0
You can use http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
to see, that it omitted B 2.0 cause 1.0 is nearer.
from page above:
by default Maven resolves version conflicts with a nearest-wins strategy.
Output'd be something like that:
[INFO] [dependency:tree]
[INFO] Project A
[INFO] +- Project-B:jar:1.0:compile
[INFO] - Project-C:jar:2.0:compile
[INFO] - (Project-B:jar:2.0:compile - ommited for conflicts with 1.0)
add a comment |
I found this explanation and it was really helpful to me.
Nearest definition means that the version used will be the closest one to your project in the tree of dependencies,
eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38867595%2fhow-does-maven-resolve-dependency-conflicts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
It'd build with Project B v 1.0
You can use http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
to see, that it omitted B 2.0 cause 1.0 is nearer.
from page above:
by default Maven resolves version conflicts with a nearest-wins strategy.
Output'd be something like that:
[INFO] [dependency:tree]
[INFO] Project A
[INFO] +- Project-B:jar:1.0:compile
[INFO] - Project-C:jar:2.0:compile
[INFO] - (Project-B:jar:2.0:compile - ommited for conflicts with 1.0)
add a comment |
It'd build with Project B v 1.0
You can use http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
to see, that it omitted B 2.0 cause 1.0 is nearer.
from page above:
by default Maven resolves version conflicts with a nearest-wins strategy.
Output'd be something like that:
[INFO] [dependency:tree]
[INFO] Project A
[INFO] +- Project-B:jar:1.0:compile
[INFO] - Project-C:jar:2.0:compile
[INFO] - (Project-B:jar:2.0:compile - ommited for conflicts with 1.0)
add a comment |
It'd build with Project B v 1.0
You can use http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
to see, that it omitted B 2.0 cause 1.0 is nearer.
from page above:
by default Maven resolves version conflicts with a nearest-wins strategy.
Output'd be something like that:
[INFO] [dependency:tree]
[INFO] Project A
[INFO] +- Project-B:jar:1.0:compile
[INFO] - Project-C:jar:2.0:compile
[INFO] - (Project-B:jar:2.0:compile - ommited for conflicts with 1.0)
It'd build with Project B v 1.0
You can use http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
to see, that it omitted B 2.0 cause 1.0 is nearer.
from page above:
by default Maven resolves version conflicts with a nearest-wins strategy.
Output'd be something like that:
[INFO] [dependency:tree]
[INFO] Project A
[INFO] +- Project-B:jar:1.0:compile
[INFO] - Project-C:jar:2.0:compile
[INFO] - (Project-B:jar:2.0:compile - ommited for conflicts with 1.0)
edited Aug 10 '16 at 8:16
answered Aug 10 '16 at 8:08
SarsethSarseth
3471217
3471217
add a comment |
add a comment |
I found this explanation and it was really helpful to me.
Nearest definition means that the version used will be the closest one to your project in the tree of dependencies,
eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
add a comment |
I found this explanation and it was really helpful to me.
Nearest definition means that the version used will be the closest one to your project in the tree of dependencies,
eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
add a comment |
I found this explanation and it was really helpful to me.
Nearest definition means that the version used will be the closest one to your project in the tree of dependencies,
eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
I found this explanation and it was really helpful to me.
Nearest definition means that the version used will be the closest one to your project in the tree of dependencies,
eg. if dependencies for A, B, and C are defined as A -> B -> C -> D 2.0 and A -> E -> D 1.0, then D 1.0 will be used when building A because the path from A to D through E is shorter. You could explicitly add a dependency to D 2.0 in A to force the use of D 2.0
answered Aug 16 '16 at 21:33
erolkaya84erolkaya84
9441219
9441219
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38867595%2fhow-does-maven-resolve-dependency-conflicts%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm not satisfied the question. According to stackoverflow.com/help/how-to-ask, you should "Explain how you encountered the problem you're trying to solve, and any difficulties that have prevented you from solving it yourself." I don't see any dififculties to prevent solve issue yourself.
– michaldo
Aug 10 '16 at 8:14
Is this a multi module build?
– khmarbaise
Aug 10 '16 at 8:22
@khmarbaise no. I have project B and project C as a dependency in the pom.xml of project A.
– erolkaya84
Aug 10 '16 at 8:26