Class Parent

java.lang.Object
org.apache.maven.api.model.Parent
All Implemented Interfaces:
Serializable, InputLocationTracker

The <parent> element contains information required to locate the parent project from which this project will inherit from.

Note: The children of this element are not interpolated and must be given as literal values.

See Also:
  • Method Details

    • getGroupId

      public String getGroupId()
      The group id of the parent project to inherit from.
      Returns:
      a String
    • getArtifactId

      public String getArtifactId()
      The artifact id of the parent project to inherit from.
      Returns:
      a String
    • getVersion

      public String getVersion()
      The version of the parent project to inherit.
      Returns:
      a String
    • getRelativePath

      public String getRelativePath()
      The relative path of the parent pom.xml file within the checkout. If not specified, it defaults to ../pom.xml. Maven looks for the parent POM first in this location on the filesystem, then the local repository, and lastly in the remote repo. relativePath allows you to select a different location, for example when your structure is flat, or deeper without an intermediate parent POM. However, the group ID, artifact ID and version are still required, and must match the file in the location given, or it will revert to the repository for the POM. This feature is only for enhancing the development in a local checkout of that project. Set the value to an empty string in case you want to disable the feature and always resolve the parent POM from the repositories.
      Returns:
      a String
    • getLocation

      public InputLocation getLocation(Object key)
      Gets the location of the specified field in the input source.
      Specified by:
      getLocation in interface InputLocationTracker
    • with

      @Nonnull public Parent.Builder with()
      Creates a new builder with this object as the basis.
      Returns:
      a Builder
    • withGroupId

      @Nonnull public Parent withGroupId(String groupId)
      Creates a new Parent instance using the specified groupId.
      Parameters:
      groupId - the new String to use
      Returns:
      a Parent with the specified groupId
    • withArtifactId

      @Nonnull public Parent withArtifactId(String artifactId)
      Creates a new Parent instance using the specified artifactId.
      Parameters:
      artifactId - the new String to use
      Returns:
      a Parent with the specified artifactId
    • withVersion

      @Nonnull public Parent withVersion(String version)
      Creates a new Parent instance using the specified version.
      Parameters:
      version - the new String to use
      Returns:
      a Parent with the specified version
    • withRelativePath

      @Nonnull public Parent withRelativePath(String relativePath)
      Creates a new Parent instance using the specified relativePath.
      Parameters:
      relativePath - the new String to use
      Returns:
      a Parent with the specified relativePath
    • newInstance

      @Nonnull public static Parent newInstance()
      Creates a new Parent instance. Equivalent to newInstance(true).
      Returns:
      a new Parent
      See Also:
    • newInstance

      @Nonnull public static Parent newInstance(boolean withDefaults)
      Creates a new Parent instance using default values or not. Equivalent to newBuilder(withDefaults).build().
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Parent
    • newBuilder

      @Nonnull public static Parent.Builder newBuilder()
      Creates a new Parent builder instance. Equivalent to newBuilder(true).
      Returns:
      a new Builder
      See Also:
    • newBuilder

      @Nonnull public static Parent.Builder newBuilder(boolean withDefaults)
      Creates a new Parent builder instance using default values or not.
      Parameters:
      withDefaults - the boolean indicating whether default values should be used
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static Parent.Builder newBuilder(Parent from)
      Creates a new Parent builder instance using the specified object as a basis. Equivalent to newBuilder(from, false).
      Parameters:
      from - the Parent instance to use as a basis
      Returns:
      a new Builder
    • newBuilder

      @Nonnull public static Parent.Builder newBuilder(Parent from, boolean forceCopy)
      Creates a new Parent builder instance using the specified object as a basis.
      Parameters:
      from - the Parent instance to use as a basis
      forceCopy - the boolean indicating if a copy should be forced
      Returns:
      a new Builder
    • getId

      public String getId()
      Returns:
      the id as groupId:artifactId:version
    • toString

      public String toString()
      Overrides:
      toString in class Object