In AEM poms I have noticed that dependency name and versions are defined in the parent pom and child poms only have dependencies defined and it is not necessary to specify a version in child poms, as the version is managed at the Parent pom. So, I am not clear on following.
1. If we already have dependencies defined in the parent pom with version no, then why do we need to define the same dependency back in child pom.xml (core/pom.xml in case of AEM). Why can't maven look for dependencies in parent pom as it looks for version?
So this is a concept of dependency management in Maven multi-module project. In Dependency management, your parent pom defines dependencies and their versions then reference these dependencies in your submodules where needed. When you require other sub-modules in your project (ie. core) then the dependencies will be found transitively.
to maintain the versions, we specify the version in parent pom which is then inherited by child pom. if you change the version you will have to build the project keeping in the parent pom. if not changing then will refer the last build dependency version.
But my question still remains - In AEM core/pom.xml, I still see the same dependency defined without version no. I mean, parent pom has same dependencies with version no and child pom has same without version no. Why are these duplicated? Why child pom is not inheriting dependencies from parent pom as mentioned in the above case?