10

maven allows you to define in pom file:

(A) dependencies -> the actual direct dependencies of the project

(B) dependencyManagement/dependencies -> managed dependencies that affect dependencies of category (A) with undefined version and transitive dependencies.

  • If I put wrong/unknown artifact on category A - maven will surely fail.
  • If I put wrong/unknown artifact on category B - maven will fail only if it affects category A (for instance, A defines dep on foo:bar and B defines dep on foo:bar:<unknown-version>.

I wonder if there is any existing plugin that will allow me to verify all managed deps (category B) - make sure they actually exist.

I have 1 global pom project with deps management that serves multiple projects and I want to verify any change to the deps in the CI before uploading new version to remote repository

orshachar
  • 4,837
  • 14
  • 45
  • 68
  • Your assumption you made is wrong, cause the dependencies tag is not inside the `build` tag. They are keep on their own. http://maven.apache.org/pom.html#Dependencies. If you check the global pom the define deps using a real pom which uses the real depenencies locally that's the test..I hope you don't upload the deps manually into remote repository... – khmarbaise Sep 06 '17 at 20:18
  • @khmarbaise It would still be great to have a check whether dependencyManagement entries actually exist, without constructing and updating a test project. – J Fabian Meier Sep 07 '17 at 13:30
  • Might be an idea for an improvement of plugins ...might be located in the maven-dependency-plugin goal like `resolve-dependency-management` something like this? Someone can make a jira request for it?... – khmarbaise Sep 07 '17 at 14:08
  • @khamrbaise - you're right. I was confused. But the question still valid – orshachar Sep 07 '17 at 22:37

1 Answers1

1

In maven dependency plugin there is goal dependency:analyze-dep-mgt. You may use it to check dependencies in dependencyManagement section of your pom.xml. If you need deeper control or more functionality, options would be to create your own plugin or have a dummy project which would use all your managed dependencies (although I should say this is a cumbersome solution).

scrutari
  • 1,378
  • 2
  • 17
  • 33