Maven dependency management dependencies for multiple projects

I apologize for this. Please let me know if I understood correctly?

We have a parent pom and several modules. Now, if all projects for children want to inherit the same jar files (for example, spring), I can put them in the parent pom project and not include them in the child pom.

And if I put dependencies in the parent pom, they are not included in all child projects, but I can include the ones I need (for example, a test), adding them without having to specify the version.

Is this correct, or am I completely disconnected? I hope that I clearly understand what I am.

All I need is a giant parent pom with all the dependencies. Children should get some of the common dependencies automatically and specific that every child needs.

thanks

Harish

+6
source share
1 answer

In dependencyManagement, you declare dependency versions, exceptions, and other things that let you manage them in place (like the parent pom) for multiple projects.

In the dependencies, you then declare the actual use / need for the dependencies, and if the dependency management is managed in the parent pump, you can do this without using the version, and it will be inherited and therefore will match your customs downstream parent pom.

The same logic applies to pluginManagement and plugins, including plugin configuration.

+16
source

Source: https://habr.com/ru/post/948073/


All Articles