In defining a parent artifact, do I need to include the in the child's pom? For example,
Is the <relativePath>
optional or required?
<parent>
<groupId>org.hibernate.tutorials</groupId>
<artifactId>hibernate-tutorials</artifactId>
<version>5.1.0.Final</version>
<relativePath>../pom.xml</relativePath>
</parent>
By default, Maven looks for the parent POM first at project's root, then the local repository, and lastly in the remote repository. If parent POM file is not located in any other place, then you can use code tag. This relative path shall be relative to project root.
This POM is the common parent of all of the Maven components in the Apache Maven project. Most of its contents are pinning down version numbers of plugins. It does provide minimal dependencyManagement for plexus-component and plugin-tools annotations.
A dependency is libraries you need to get your code to compile. This can be your own code, or libraries such as Apache Commons. A parent contains information, but nothing to actually build, that is shared between a number of your projects.
groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project.
It is not required. From the docs:
relativePath
: The relative path of the parentpom.xml
file within the check out. If not specified, it defaults to../pom.xml
. [...]
This means that you can omit this element and it will default to exactly what you already have, i.e. Maven will look for the parent POM in ../pom.xml
which is one directory up.
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