Home > Enterprise >  which dependencies can be suppressed and which cannot ? on a maven dependency check
which dependencies can be suppressed and which cannot ? on a maven dependency check

Time:08-08

How do I know which dependencies I need to suppress? Basically, what makes the difference in the dependencies that are not relevant to those that are?

an example would be extremely helpful.

CodePudding user response:

If you have the time, you can remove all the dependencies from your pom, keeping them aside in a .bak file.

Of course, the compilation will fail,
but then you add them back, one by one, and only the one Maven build is complaining about their lack.

Then you execute and check that everything in your application is still working well.

That way, you seldom remove two or three dependencies when the project is very old.

CodePudding user response:

Each Maven dependency can provide some of transitive dependencies.

Each used dependency in your project is relevant, simply project will not compile without it. Some of dependencies can be needed in runtime by your project.

You can read about Maven Dependency Mechanism and how to exclude dependencies.

You can also examine output of:

  • mvn dependency:analyze
  • mvn dependency:tree

Please familiarize yourself with documentation of Maven Dependency Plugin

  • Related