Search code examples
mavendirectorypom.xmlartifactparent-pom

What does the parent tag in Maven pom represent?


E.g.:

<parent>
    <groupId>mycompany.trade.com</groupId>
    <artifactId>mycompany.trade.</artifactId>
    <version>1.1.1.0-SNAPSHOT</version>
</parent>

Does it mean that Maven will search for parent pom? If yes, where, in which order? May be in folder up 1 level? Or in local repository or in repo?


Solution

  • Yes, maven reads the parent POM from your local repository (or proxies like nexus) and creates an 'effective POM' by merging the information from parent and module POM.

    See also Introduction to the POM

    One reason to use a parent is that you have a central place to store information about versions of artifacts, compiler-settings etc. that should be used in all modules.