@Experimental @Generated @ThreadSafe @Immutable public class Parent extends Object implements Serializable, InputLocationTracker
<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.Modifier and Type | Class and Description |
---|---|
static class |
Parent.Builder
Builder class used to create Parent instances.
|
Modifier and Type | Method and Description |
---|---|
String |
getArtifactId()
The artifact id of the parent project to inherit from.
|
String |
getGroupId()
The group id of the parent project to inherit from.
|
String |
getId() |
InputLocation |
getLocation(Object key)
Gets the location of the specified field in the input source.
|
String |
getRelativePath()
The relative path of the parent
pom.xml file within the check out. |
String |
getVersion()
The version of the parent project to inherit.
|
static Parent.Builder |
newBuilder()
Creates a new
Parent builder instance. |
static Parent.Builder |
newBuilder(boolean withDefaults)
Creates a new
Parent builder instance using default values or not. |
static Parent.Builder |
newBuilder(Parent from)
Creates a new
Parent builder instance using the specified object as a basis. |
static Parent.Builder |
newBuilder(Parent from,
boolean forceCopy)
Creates a new
Parent builder instance using the specified object as a basis. |
static Parent |
newInstance()
Creates a new
Parent instance. |
static Parent |
newInstance(boolean withDefaults)
Creates a new
Parent instance using default values or not. |
String |
toString() |
Parent.Builder |
with()
Creates a new builder with this object as the basis.
|
Parent |
withArtifactId(String artifactId)
Creates a new
Parent instance using the specified artifactId. |
Parent |
withGroupId(String groupId)
Creates a new
Parent instance using the specified groupId. |
Parent |
withRelativePath(String relativePath)
Creates a new
Parent instance using the specified relativePath. |
Parent |
withVersion(String version)
Creates a new
Parent instance using the specified version. |
public String getGroupId()
String
public String getArtifactId()
String
public String getVersion()
String
public String getRelativePath()
pom.xml
file within the check out.
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.String
public InputLocation getLocation(Object key)
getLocation
in interface InputLocationTracker
@Nonnull public Parent.Builder with()
Builder
@Nonnull public Parent withGroupId(String groupId)
Parent
instance using the specified groupId.groupId
- the new String
to useParent
with the specified groupId@Nonnull public Parent withArtifactId(String artifactId)
Parent
instance using the specified artifactId.artifactId
- the new String
to useParent
with the specified artifactId@Nonnull public Parent withVersion(String version)
Parent
instance using the specified version.version
- the new String
to useParent
with the specified version@Nonnull public Parent withRelativePath(String relativePath)
Parent
instance using the specified relativePath.relativePath
- the new String
to useParent
with the specified relativePath@Nonnull public static Parent newInstance()
Parent
instance.
Equivalent to newInstance( true )
.Parent
newInstance(boolean)
@Nonnull public static Parent newInstance(boolean withDefaults)
Parent
instance using default values or not.
Equivalent to newBuilder( withDefaults ).build()
.withDefaults
- the boolean indicating whether default values should be usedParent
@Nonnull public static Parent.Builder newBuilder()
Parent
builder instance.
Equivalent to newBuilder( true )
.Builder
newBuilder(boolean)
@Nonnull public static Parent.Builder newBuilder(boolean withDefaults)
Parent
builder instance using default values or not.withDefaults
- the boolean indicating whether default values should be usedBuilder
@Nonnull public static Parent.Builder newBuilder(Parent from)
Parent
builder instance using the specified object as a basis.
Equivalent to newBuilder( from, false )
.from
- the Parent
instance to use as a basisBuilder
@Nonnull public static Parent.Builder newBuilder(Parent from, boolean forceCopy)
Parent
builder instance using the specified object as a basis.from
- the Parent
instance to use as a basisforceCopy
- the boolean indicating if a copy should be forcedBuilder
public String getId()
groupId:artifactId:version
Copyright © 2001–2022 The Apache Software Foundation. All rights reserved.