Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dependencies.dependency.version is missing even though the dependency is already declared in its parent's pom file's dependency management section

As described, the dependency:tree goal on my my project complains that the dependency version is missing for a dependency that is already declared in the dependency management section of its parent pom. Please note the dependency in question is a new one and is just added in the management section.

like image 765
Hui Wang Avatar asked Dec 20 '25 11:12

Hui Wang


2 Answers

It's true that the parent pom has already included the dependency declaration in the dependency management section. But it's not taken into account. To do so, we should execute the command to install the pom file in the local maven repo.

mvn -f <the absolute path to the parent's pom file> install -N

Be aware that when maven resolves dependencies, it always looks for pom files already available in the repo. Instead, local files are not taken into account.

like image 154
Hui Wang Avatar answered Dec 23 '25 16:12

Hui Wang


Another reason why Maven complains about missing dependency is when dependency declared in parent pom has < type> that doesn't correspond to the type that the child pom is looking for.

like image 44
zdenekca Avatar answered Dec 23 '25 15:12

zdenekca