Sorry to ask this again. Please let me know if I got this right?
We have a parent pom and multiple modules. Now if all children projects want to inherit the same jar files (for example spring), I can put them in in the parent project pom and need not include them in the child pom.
And if I put in dependencies under in the parent pom, they are not included in all the children projects, but I can include the ones I need (for example test) by adding them in without the need to specify a version.
Is this right or am I totally off? Hope I'm clear on my q.
All I need is a giant parent pom with all dependencies. The children should get some of the common dependencies automatically and the specific ones that each child needs.
Thanks
Harish
dependencyManagement is just a declaration, and it does not really add a dependency. The declared dependencies in this section must be later used by the dependencies tag. It is just the dependencies tag that causes real dependency to happen.
Dependency management in Maven allows teams to manage dependencies for multi-module projects and applications. These can consist of hundreds or even thousands of modules. Using Maven can help teams define, create, and maintain reproducible builds.
Dependency management - this allows project authors to directly specify the versions of artifacts to be used when they are encountered in transitive dependencies or in dependencies where no version has been specified.
Right-click the utility project, and select Maven>Add Dependency. Type a dependency name in the Enter groupID… field (e.g., commons-logging) to search for a dependency. Select the dependency, and click OK.
In dependencyManagement you declare dependency versions, exclusions and other things that let you manage them in place (e.g. a parent pom) for multiple projects.
In dependencies you then declare the actual usage/need of a dependency and if the dependency is managed in a parent pom you can do so without using a version and it will be inherited and therefore be consistant across your usages downstream of the the parent pom.
Same logic applies for pluginManagement and plugins by the way including plugin configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With