Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven artifact : x (managed from y)

enter image description here

I actually was expecting powermock version 1.5.6 via transitive dependencies in a project, but i get only 1.4.11. What does this mean?

like image 285
nikel Avatar asked Sep 28 '22 19:09

nikel


People also ask

How do I exclude a specific version of a dependency in Maven?

Multiple transitive dependencies can be excluded by using the <exclusion> tag for each of the dependency you want to exclude and placing all these exclusion tags inside the <exclusions> tag in pom. xml. You will need to mention the group id and artifact id of the dependency you wish to exclude in the exclusion tag.

How do I change the transitive dependency?

How do you do this if the wrong dependency is a transitive dependency? By taking advantage of Maven's nearest definition logic, developers can override the version of a dependency by declaring it on the root pom. xml file. The example below shows an overridden version for checker-qual and how it was managed by Maven.

What is dependencyManagement in POM xml?

The dependency management section is a mechanism for centralizing dependency information. When you have a set of projects that inherit from a common parent, it's possible to put all information about the dependency in the common POM and have simpler references to the artifacts in the child POMs.

What is groupId and artifactId in Maven?

3.1.groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project. packaging – a packaging method (e.g. WAR/JAR/ZIP)


1 Answers

When resolving dependencies, Maven will prefer a version specified in the POM's section over the version resolved from dependencies and transitive dependencies.

Note that can be inherited from a parent POM.

See the Maven documentation on Dependency Mechanism for more info.

Specifically, check the part of the page that starts as below for a detailed explanation.

A second, and very important use of the dependency management section is to control the versions of artifacts used in transitive dependencies. As an example consider these projects:

like image 135
tschaible Avatar answered Oct 06 '22 00:10

tschaible