Is there a way to write a test that checks Maven dependencies?
In our project, we found these problems:
-
Some parts of the project use
commons-io:commons-io, others usedorg.apache.commons:commons-io -
The wrong version of a dependency was used
-
staxuses the versions1.0-2and1.0.1. Using the automatic dependency resolution,1.0-2wins.
So what I want is to write a test case which takes the current dependency tree as input and runs a couple of checks on it. Is that possible?
Check this answer too.
Here is an assert method for StAX and other dependencies which don’t contain
pom.propertiesjustmanifest.mf. Maybe it would worth caching thePropertiesinstances if there are lots ofassertDependencyByMetaInfcalls.