- What is the reason for having multiple pom.xml for all dependency libraries instead of having all dependencies in one pom.xml?
A maven project can be made from many artifacts. One artifact may be a string manipulation library. Another might be a webapp that uses this String manipulation library.
This is why you should not put all your dependencies in one pom: your string manipulation library should not have a link to servlets.jar just because the unbound pom is webapp. Each artifact should have only what it needs in its path to the classes.
(You may be interested in learning about the dependencyManagement tag, but it is not directly related to your question.)
- Where should these pom.xml files be located in the Maven project?
Like @MariuszS related to Standard Directory Layout .
In the top-level files describing the project: the pom.xml file (and any properties, maven.xml or build.xml when using Ant). In addition, there are text documents designed so that the user can immediately read the receiver: README.txt, LICENSE.txt, etc.
source share