Package org.apache.maven.api.model
Class Model
java.lang.Object
org.apache.maven.api.model.ModelBase
org.apache.maven.api.model.Model
- All Implemented Interfaces:
Serializable
,InputLocationTracker
@Experimental
@Generated
@ThreadSafe
@Immutable
public class Model
extends ModelBase
implements Serializable, InputLocationTracker
The
<project>
element is the root of the descriptor.
The following table lists all of the possible child elements.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class used to create Model instances. -
Method Summary
Modifier and TypeMethodDescriptionThe identifier for this artifact that is unique within the group given by the group ID.getBuild()
Information required to build the project.When children inherit from project's url, append path or not? Note: While the type of this field isString
for technical reasons, the semantic type is actuallyBoolean
The project's continuous integration information.Describes the contributors to a project that are not yet committers.A detailed description of the project, used by Maven whenever it needs to describe the project, such as on the website.Describes the committers of a project.A universally unique identifier for a project.getId()
The year of the project's inception, specified with 4 digits.The project's issue management system information.This element describes all the licenses for this project.Contains information about a project's mailing lists.Declares to which version of project descriptor this POM conforms.getName()
The full name of the project.This element describes various attributes of the organization to which the project belongs.The type of artifact this project produces, for examplejar
,war
,ear
,pom
.The location of the parent project, if one exists.Originating POM fileDescribes the prerequisites in the build environment for this project.A listing of project-local build profiles which will modify the build process when activated.Gets the base directory for the corresponding project (if any).getScm()
Specification for the SCM used by the project, such as CVS, Subversion, etc.getUrl()
The URL to the project's homepage.The current version of the artifact produced by this project.boolean
boolean
Indicates if the build POM for this project should be preserved or downgraded to the lowest compatible version.boolean
isRoot()
Indicates that this project is the root project, located in the upper directory of the source tree.static Model.Builder
Creates a newModel
builder instance.static Model.Builder
newBuilder
(boolean withDefaults) Creates a newModel
builder instance using default values or not.static Model.Builder
newBuilder
(Model from) Creates a newModel
builder instance using the specified object as a basis.static Model.Builder
newBuilder
(Model from, boolean forceCopy) Creates a newModel
builder instance using the specified object as a basis.static Model
Creates a newModel
instance.static Model
newInstance
(boolean withDefaults) Creates a newModel
instance using default values or not.toString()
with()
Creates a new builder with this object as the basis.withArtifactId
(String artifactId) Creates a newModel
instance using the specified artifactId.Creates a newModel
instance using the specified build.withChildProjectUrlInheritAppendPath
(String childProjectUrlInheritAppendPath) Creates a newModel
instance using the specified childProjectUrlInheritAppendPath.withCiManagement
(CiManagement ciManagement) Creates a newModel
instance using the specified ciManagement.withContributors
(Collection<Contributor> contributors) Creates a newModel
instance using the specified contributors.withDependencies
(Collection<Dependency> dependencies) Creates a newModel
instance using the specified dependencies.withDependencyManagement
(DependencyManagement dependencyManagement) Creates a newModel
instance using the specified dependencyManagement.withDescription
(String description) Creates a newModel
instance using the specified description.withDevelopers
(Collection<Developer> developers) Creates a newModel
instance using the specified developers.withDistributionManagement
(DistributionManagement distributionManagement) Creates a newModel
instance using the specified distributionManagement.withGroupId
(String groupId) Creates a newModel
instance using the specified groupId.withInceptionYear
(String inceptionYear) Creates a newModel
instance using the specified inceptionYear.withIssueManagement
(IssueManagement issueManagement) Creates a newModel
instance using the specified issueManagement.withLicenses
(Collection<License> licenses) Creates a newModel
instance using the specified licenses.withMailingLists
(Collection<MailingList> mailingLists) Creates a newModel
instance using the specified mailingLists.withModelVersion
(String modelVersion) Creates a newModel
instance using the specified modelVersion.withModules
(Collection<String> modules) Creates a newModel
instance using the specified modules.Creates a newModel
instance using the specified name.withOrganization
(Organization organization) Creates a newModel
instance using the specified organization.withPackaging
(String packaging) Creates a newModel
instance using the specified packaging.withParent
(Parent parent) Creates a newModel
instance using the specified parent.withPluginRepositories
(Collection<Repository> pluginRepositories) Creates a newModel
instance using the specified pluginRepositories.withPomFile
(Path pomFile) Creates a newModel
instance using the specified pomFile.withPrerequisites
(Prerequisites prerequisites) Creates a newModel
instance using the specified prerequisites.withPreserveModelVersion
(boolean preserveModelVersion) Creates a newModel
instance using the specified preserveModelVersion.withProfiles
(Collection<Profile> profiles) Creates a newModel
instance using the specified profiles.withProperties
(Map<String, String> properties) Creates a newModel
instance using the specified properties.withReporting
(Reporting reporting) Creates a newModel
instance using the specified reporting.withRepositories
(Collection<Repository> repositories) Creates a newModel
instance using the specified repositories.withRoot
(boolean root) Creates a newModel
instance using the specified root.Creates a newModel
instance using the specified scm.Creates a newModel
instance using the specified url.withVersion
(String version) Creates a newModel
instance using the specified version.Methods inherited from class org.apache.maven.api.model.ModelBase
getDependencies, getDependencyManagement, getDistributionManagement, getLocation, getModules, getPluginRepositories, getProperties, getReporting, getRepositories, newBuilder, newBuilder
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.maven.api.model.InputLocationTracker
getLocation
-
Method Details
-
getNamespaceUri
-
getModelEncoding
-
getPomFile
Originating POM file- Returns:
- a
Path
-
getModelVersion
Declares to which version of project descriptor this POM conforms.- Returns:
- a
String
-
getParent
The location of the parent project, if one exists. Values from the parent project will be the default for this project if they are left unspecified. The location is given as a group ID, artifact ID and version.- Returns:
- a
Parent
-
getGroupId
A universally unique identifier for a project. It is normal to use a fully-qualified package name to distinguish it from other projects with a similar name (eg.org.apache.maven
).- Returns:
- a
String
-
getArtifactId
The identifier for this artifact that is unique within the group given by the group ID. An artifact is something that is either produced or used by a project. Examples of artifacts produced by Maven for a project include: JARs, source and binary distributions, and WARs.- Returns:
- a
String
-
getVersion
The current version of the artifact produced by this project.- Returns:
- a
String
-
getPackaging
The type of artifact this project produces, for examplejar
,war
,ear
,pom
. Plugins can create their own packaging, and therefore their own packaging types, so this list does not contain all possible types.- Returns:
- a
String
-
getName
The full name of the project.- Returns:
- a
String
-
getDescription
A detailed description of the project, used by Maven whenever it needs to describe the project, such as on the website. While this element can be specified as CDATA to enable the use of HTML tags within the description, it is discouraged to allow plain text representation. If you need to modify the index page of the generated website, you are able to specify your own instead of adjusting this text.- Returns:
- a
String
-
getUrl
The URL to the project's homepage.Default value is: parent value [+ path adjustment] + (artifactId or project.directory property), or just parent value if project's
child.project.url.inherit.append.path="false"
- Returns:
- a
String
-
getChildProjectUrlInheritAppendPath
When children inherit from project's url, append path or not? Note: While the type of this field isString
for technical reasons, the semantic type is actuallyBoolean
Default value is:
true
- Returns:
- a
String
- Since:
- Maven 3.6.1
-
isRoot
public boolean isRoot()Indicates that this project is the root project, located in the upper directory of the source tree. This is the directory which may contain the .mvn directory.- Returns:
- a
boolean
- Since:
- Maven 4.0.0
-
isPreserveModelVersion
public boolean isPreserveModelVersion()Indicates if the build POM for this project should be preserved or downgraded to the lowest compatible version.- Returns:
- a
boolean
- Since:
- Maven 4.0.0
-
getInceptionYear
The year of the project's inception, specified with 4 digits. This value is used when generating copyright notices as well as being informational.- Returns:
- a
String
-
getOrganization
This element describes various attributes of the organization to which the project belongs. These attributes are utilized when documentation is created (for copyright notices and links).- Returns:
- a
Organization
-
getLicenses
This element describes all the licenses for this project. Each license is described by alicense
element, which is then described by additional elements. Projects should only list the license(s) that applies to the project and not the licenses that apply to dependencies. If multiple licenses are listed, it is assumed that the user can select any of them, not that they must accept all.- Returns:
- a
List<License>
-
getDevelopers
Describes the committers of a project.- Returns:
- a
List<Developer>
-
getContributors
Describes the contributors to a project that are not yet committers.- Returns:
- a
List<Contributor>
-
getMailingLists
Contains information about a project's mailing lists.- Returns:
- a
List<MailingList>
-
getPrerequisites
Describes the prerequisites in the build environment for this project.- Returns:
- a
Prerequisites
-
getScm
Specification for the SCM used by the project, such as CVS, Subversion, etc.- Returns:
- a
Scm
-
getIssueManagement
The project's issue management system information.- Returns:
- a
IssueManagement
-
getCiManagement
The project's continuous integration information.- Returns:
- a
CiManagement
-
getBuild
Information required to build the project.- Returns:
- a
Build
-
getProfiles
A listing of project-local build profiles which will modify the build process when activated.- Returns:
- a
List<Profile>
-
with
Creates a new builder with this object as the basis. -
withModules
Creates a newModel
instance using the specified modules.- Overrides:
withModules
in classModelBase
- Parameters:
modules
- the newCollection<String>
to use- Returns:
- a
Model
with the specified modules
-
withDistributionManagement
Creates a newModel
instance using the specified distributionManagement.- Overrides:
withDistributionManagement
in classModelBase
- Parameters:
distributionManagement
- the newDistributionManagement
to use- Returns:
- a
Model
with the specified distributionManagement
-
withProperties
Creates a newModel
instance using the specified properties.- Overrides:
withProperties
in classModelBase
- Parameters:
properties
- the newMap<String, String>
to use- Returns:
- a
Model
with the specified properties
-
withDependencyManagement
Creates a newModel
instance using the specified dependencyManagement.- Overrides:
withDependencyManagement
in classModelBase
- Parameters:
dependencyManagement
- the newDependencyManagement
to use- Returns:
- a
Model
with the specified dependencyManagement
-
withDependencies
Creates a newModel
instance using the specified dependencies.- Overrides:
withDependencies
in classModelBase
- Parameters:
dependencies
- the newCollection<Dependency>
to use- Returns:
- a
Model
with the specified dependencies
-
withRepositories
Creates a newModel
instance using the specified repositories.- Overrides:
withRepositories
in classModelBase
- Parameters:
repositories
- the newCollection<Repository>
to use- Returns:
- a
Model
with the specified repositories
-
withPluginRepositories
Creates a newModel
instance using the specified pluginRepositories.- Overrides:
withPluginRepositories
in classModelBase
- Parameters:
pluginRepositories
- the newCollection<Repository>
to use- Returns:
- a
Model
with the specified pluginRepositories
-
withReporting
Creates a newModel
instance using the specified reporting.- Overrides:
withReporting
in classModelBase
- Parameters:
reporting
- the newReporting
to use- Returns:
- a
Model
with the specified reporting
-
withPomFile
Creates a newModel
instance using the specified pomFile.- Parameters:
pomFile
- the newPath
to use- Returns:
- a
Model
with the specified pomFile
-
withModelVersion
Creates a newModel
instance using the specified modelVersion.- Parameters:
modelVersion
- the newString
to use- Returns:
- a
Model
with the specified modelVersion
-
withParent
Creates a newModel
instance using the specified parent.- Parameters:
parent
- the newParent
to use- Returns:
- a
Model
with the specified parent
-
withGroupId
Creates a newModel
instance using the specified groupId.- Parameters:
groupId
- the newString
to use- Returns:
- a
Model
with the specified groupId
-
withArtifactId
Creates a newModel
instance using the specified artifactId.- Parameters:
artifactId
- the newString
to use- Returns:
- a
Model
with the specified artifactId
-
withVersion
Creates a newModel
instance using the specified version.- Parameters:
version
- the newString
to use- Returns:
- a
Model
with the specified version
-
withPackaging
Creates a newModel
instance using the specified packaging.- Parameters:
packaging
- the newString
to use- Returns:
- a
Model
with the specified packaging
-
withName
Creates a newModel
instance using the specified name.- Parameters:
name
- the newString
to use- Returns:
- a
Model
with the specified name
-
withDescription
Creates a newModel
instance using the specified description.- Parameters:
description
- the newString
to use- Returns:
- a
Model
with the specified description
-
withUrl
Creates a newModel
instance using the specified url.- Parameters:
url
- the newString
to use- Returns:
- a
Model
with the specified url
-
withChildProjectUrlInheritAppendPath
Creates a newModel
instance using the specified childProjectUrlInheritAppendPath.- Parameters:
childProjectUrlInheritAppendPath
- the newString
to use- Returns:
- a
Model
with the specified childProjectUrlInheritAppendPath
-
withRoot
Creates a newModel
instance using the specified root.- Parameters:
root
- the newboolean
to use- Returns:
- a
Model
with the specified root
-
withPreserveModelVersion
Creates a newModel
instance using the specified preserveModelVersion.- Parameters:
preserveModelVersion
- the newboolean
to use- Returns:
- a
Model
with the specified preserveModelVersion
-
withInceptionYear
Creates a newModel
instance using the specified inceptionYear.- Parameters:
inceptionYear
- the newString
to use- Returns:
- a
Model
with the specified inceptionYear
-
withOrganization
Creates a newModel
instance using the specified organization.- Parameters:
organization
- the newOrganization
to use- Returns:
- a
Model
with the specified organization
-
withLicenses
Creates a newModel
instance using the specified licenses.- Parameters:
licenses
- the newCollection<License>
to use- Returns:
- a
Model
with the specified licenses
-
withDevelopers
Creates a newModel
instance using the specified developers.- Parameters:
developers
- the newCollection<Developer>
to use- Returns:
- a
Model
with the specified developers
-
withContributors
Creates a newModel
instance using the specified contributors.- Parameters:
contributors
- the newCollection<Contributor>
to use- Returns:
- a
Model
with the specified contributors
-
withMailingLists
Creates a newModel
instance using the specified mailingLists.- Parameters:
mailingLists
- the newCollection<MailingList>
to use- Returns:
- a
Model
with the specified mailingLists
-
withPrerequisites
Creates a newModel
instance using the specified prerequisites.- Parameters:
prerequisites
- the newPrerequisites
to use- Returns:
- a
Model
with the specified prerequisites
-
withScm
Creates a newModel
instance using the specified scm.- Parameters:
scm
- the newScm
to use- Returns:
- a
Model
with the specified scm
-
withIssueManagement
Creates a newModel
instance using the specified issueManagement.- Parameters:
issueManagement
- the newIssueManagement
to use- Returns:
- a
Model
with the specified issueManagement
-
withCiManagement
Creates a newModel
instance using the specified ciManagement.- Parameters:
ciManagement
- the newCiManagement
to use- Returns:
- a
Model
with the specified ciManagement
-
withBuild
Creates a newModel
instance using the specified build.- Parameters:
build
- the newBuild
to use- Returns:
- a
Model
with the specified build
-
withProfiles
Creates a newModel
instance using the specified profiles.- Parameters:
profiles
- the newCollection<Profile>
to use- Returns:
- a
Model
with the specified profiles
-
newInstance
Creates a newModel
instance. Equivalent tonewInstance(true)
.- Returns:
- a new
Model
- See Also:
-
newInstance
Creates a newModel
instance using default values or not. Equivalent tonewBuilder(withDefaults).build()
.- Parameters:
withDefaults
- the boolean indicating whether default values should be used- Returns:
- a new
Model
-
newBuilder
Creates a newModel
builder instance. Equivalent tonewBuilder(true)
.- Returns:
- a new
Builder
- See Also:
-
newBuilder
Creates a newModel
builder instance using default values or not.- Parameters:
withDefaults
- the boolean indicating whether default values should be used- Returns:
- a new
Builder
-
newBuilder
Creates a newModel
builder instance using the specified object as a basis. Equivalent tonewBuilder(from, false)
.- Parameters:
from
- theModel
instance to use as a basis- Returns:
- a new
Builder
-
newBuilder
Creates a newModel
builder instance using the specified object as a basis.- Parameters:
from
- theModel
instance to use as a basisforceCopy
- the boolean indicating if a copy should be forced- Returns:
- a new
Builder
-
getProjectDirectory
Gets the base directory for the corresponding project (if any).- Returns:
- The base directory for the corresponding project or
null
if this model does not belong to a local project (e.g. describes the metadata of some artifact from the repository).
-
getId
- Returns:
- the model id as
groupId:artifactId:packaging:version
-
toString
-
isChildProjectUrlInheritAppendPath
public boolean isChildProjectUrlInheritAppendPath()
-