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:
  • Constructor Details

  • 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 subproject POM file or directory within the checkout. If not specified, it defaults to .., i.e. the parent directory. Maven looks for the parent POM first in this location on the filesystem if explicitly provided, then in the reactor if groupId and artifactId are provided, then in the default parent directory, then the local repository, and lastly in the remote repo. However, if the both relative path and the group ID / artifact ID are provided, they must match the file in the location given. Specify either the relativePath or the groupId/artifactId, not both.
      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
    • getLocationKeys

      public Set<Object> getLocationKeys()
      Gets the keys of the locations of the input source.
    • getLocationKeyStream

      protected Stream<Object> getLocationKeyStream()
    • getImportedFrom

      public InputLocation getImportedFrom()
      Gets the input location that caused this model to be read.
      Specified by:
      getImportedFrom in interface InputLocationTracker
      Returns:
      InputLocation
    • 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