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

    • getModelEncoding

      public String getModelEncoding()
    • getPomFile

      public Path getPomFile()
      Originating POM file
      Returns:
      a Path
    • getModelVersion

      public String getModelVersion()
      Declares to which version of project descriptor this POM conforms.
      Returns:
      a String
    • getParent

      public Parent 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

      public String 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

      public 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

      public String getVersion()
      The current version of the artifact produced by this project.
      Returns:
      a String
    • getPackaging

      public String getPackaging()
      The type of artifact this project produces, for example jar 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

      public String getName()
      The full name of the project.
      Returns:
      a String
    • getDescription

      public String getDescription()
      A detailed description of the project, used by Maven whenever it needs to describe the project, such as on the web site. 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 web site, you are able to specify your own instead of adjusting this text.
      Returns:
      a String
    • getUrl

      public 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

      public String getChildProjectUrlInheritAppendPath()
      When children inherit from project's url, append path or not? Note: While the type of this field is String for technical reasons, the semantic type is actually Boolean
      Default value is: true
      Since: Maven 3.6.1
      Returns:
      a String
    • 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.
      Since: Maven 4.0.0
      Returns:
      a boolean
    • getInceptionYear

      public String 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

      public Organization 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

      @Nonnull public List<License> getLicenses()
      This element describes all of the licenses for this project. Each license is described by a license 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

      @Nonnull public List<Developer> getDevelopers()
      Describes the committers of a project.
      Returns:
      a List<Developer>
    • getContributors

      @Nonnull public List<Contributor> getContributors()
      Describes the contributors to a project that are not yet committers.
      Returns:
      a List<Contributor>
    • getMailingLists

      @Nonnull public List<MailingList> getMailingLists()
      Contains information about a project's mailing lists.
      Returns:
      a List<MailingList>
    • getPrerequisites

      public Prerequisites getPrerequisites()
      Describes the prerequisites in the build environment for this project.
      Returns:
      a Prerequisites
    • getScm

      public Scm getScm()
      Specification for the SCM used by the project, such as CVS, Subversion, etc.
      Returns:
      a Scm
    • getIssueManagement

      public IssueManagement getIssueManagement()
      The project's issue management system information.
      Returns:
      a IssueManagement
    • getCiManagement

      public CiManagement getCiManagement()
      The project's continuous integration information.
      Returns:
      a CiManagement
    • getBuild

      public Build getBuild()
      Information required to build the project.
      Returns:
      a Build
    • getProfiles

      @Nonnull public List<Profile> getProfiles()
      A listing of project-local build profiles which will modify the build process when activated.
      Returns:
      a List<Profile>
    • with

      @Nonnull public Model.Builder with()
      Creates a new builder with this object as the basis.
      Overrides:
      with in class ModelBase
      Returns:
      a Builder
    • withModules

      @Nonnull public Model withModules(Collection<String> modules)
      Creates a new Model instance using the specified modules.
      Overrides:
      withModules in class ModelBase
      Parameters:
      modules - the new Collection<String> to use
      Returns:
      a Model with the specified modules
    • withDistributionManagement

      @Nonnull public Model withDistributionManagement(DistributionManagement distributionManagement)
      Creates a new Model instance using the specified distributionManagement.
      Overrides:
      withDistributionManagement in class ModelBase
      Parameters:
      distributionManagement - the new DistributionManagement to use
      Returns:
      a Model with the specified distributionManagement
    • withProperties

      @Nonnull public Model withProperties(Map<String,String> properties)
      Creates a new Model instance using the specified properties.
      Overrides:
      withProperties in class ModelBase
      Parameters:
      properties - the new Map<String, String> to use
      Returns:
      a Model with the specified properties
    • withDependencyManagement

      @Nonnull public Model withDependencyManagement(DependencyManagement dependencyManagement)
      Creates a new Model instance using the specified dependencyManagement.
      Overrides:
      withDependencyManagement in class ModelBase
      Parameters:
      dependencyManagement - the new DependencyManagement to use
      Returns:
      a Model with the specified dependencyManagement
    • withDependencies

      @Nonnull public Model withDependencies(Collection<Dependency> dependencies)
      Creates a new Model instance using the specified dependencies.
      Overrides:
      withDependencies in class ModelBase
      Parameters:
      dependencies - the new Collection<Dependency> to use
      Returns:
      a Model with the specified dependencies
    • withRepositories

      @Nonnull public Model withRepositories(Collection<Repository> repositories)
      Creates a new Model instance using the specified repositories.
      Overrides:
      withRepositories in class ModelBase
      Parameters:
      repositories - the new Collection<Repository> to use
      Returns:
      a Model with the specified repositories
    • withPluginRepositories

      @Nonnull public Model withPluginRepositories(Collection<Repository> pluginRepositories)
      Creates a new Model instance using the specified pluginRepositories.
      Overrides:
      withPluginRepositories in class ModelBase
      Parameters:
      pluginRepositories - the new Collection<Repository> to use
      Returns:
      a Model with the specified pluginRepositories
    • withReporting

      @Nonnull public Model withReporting(Reporting reporting)
      Creates a new Model instance using the specified reporting.
      Overrides:
      withReporting in class ModelBase
      Parameters:
      reporting - the new Reporting to use
      Returns:
      a Model with the specified reporting
    • withPomFile

      @Nonnull public Model withPomFile(Path pomFile)
      Creates a new Model instance using the specified pomFile.
      Parameters:
      pomFile - the new Path to use
      Returns:
      a Model with the specified pomFile
    • withModelVersion

      @Nonnull public Model withModelVersion(String modelVersion)
      Creates a new Model instance using the specified modelVersion.
      Parameters:
      modelVersion - the new String to use
      Returns:
      a Model with the specified modelVersion
    • withParent

      @Nonnull public Model withParent(Parent parent)
      Creates a new Model instance using the specified parent.
      Parameters:
      parent - the new Parent to use
      Returns:
      a Model with the specified parent
    • withGroupId

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

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

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

      @Nonnull public Model withPackaging(String packaging)
      Creates a new Model instance using the specified packaging.
      Parameters:
      packaging - the new String to use
      Returns:
      a Model with the specified packaging
    • withName

      @Nonnull public Model withName(String name)
      Creates a new Model instance using the specified name.
      Parameters:
      name - the new String to use
      Returns:
      a Model with the specified name
    • withDescription

      @Nonnull public Model withDescription(String description)
      Creates a new Model instance using the specified description.
      Parameters:
      description - the new String to use
      Returns:
      a Model with the specified description
    • withUrl

      @Nonnull public Model withUrl(String url)
      Creates a new Model instance using the specified url.
      Parameters:
      url - the new String to use
      Returns:
      a Model with the specified url
    • withChildProjectUrlInheritAppendPath

      @Nonnull public Model withChildProjectUrlInheritAppendPath(String childProjectUrlInheritAppendPath)
      Creates a new Model instance using the specified childProjectUrlInheritAppendPath.
      Parameters:
      childProjectUrlInheritAppendPath - the new String to use
      Returns:
      a Model with the specified childProjectUrlInheritAppendPath
    • withRoot

      @Nonnull public Model withRoot(boolean root)
      Creates a new Model instance using the specified root.
      Parameters:
      root - the new boolean to use
      Returns:
      a Model with the specified root
    • withInceptionYear

      @Nonnull public Model withInceptionYear(String inceptionYear)
      Creates a new Model instance using the specified inceptionYear.
      Parameters:
      inceptionYear - the new String to use
      Returns:
      a Model with the specified inceptionYear
    • withOrganization

      @Nonnull public Model withOrganization(Organization organization)
      Creates a new Model instance using the specified organization.
      Parameters:
      organization - the new Organization to use
      Returns:
      a Model with the specified organization
    • withLicenses

      @Nonnull public Model withLicenses(Collection<License> licenses)
      Creates a new Model instance using the specified licenses.
      Parameters:
      licenses - the new Collection<License> to use
      Returns:
      a Model with the specified licenses
    • withDevelopers

      @Nonnull public Model withDevelopers(Collection<Developer> developers)
      Creates a new Model instance using the specified developers.
      Parameters:
      developers - the new Collection<Developer> to use
      Returns:
      a Model with the specified developers
    • withContributors

      @Nonnull public Model withContributors(Collection<Contributor> contributors)
      Creates a new Model instance using the specified contributors.
      Parameters:
      contributors - the new Collection<Contributor> to use
      Returns:
      a Model with the specified contributors
    • withMailingLists

      @Nonnull public Model withMailingLists(Collection<MailingList> mailingLists)
      Creates a new Model instance using the specified mailingLists.
      Parameters:
      mailingLists - the new Collection<MailingList> to use
      Returns:
      a Model with the specified mailingLists
    • withPrerequisites

      @Nonnull public Model withPrerequisites(Prerequisites prerequisites)
      Creates a new Model instance using the specified prerequisites.
      Parameters:
      prerequisites - the new Prerequisites to use
      Returns:
      a Model with the specified prerequisites
    • withScm

      @Nonnull public Model withScm(Scm scm)
      Creates a new Model instance using the specified scm.
      Parameters:
      scm - the new Scm to use
      Returns:
      a Model with the specified scm
    • withIssueManagement

      @Nonnull public Model withIssueManagement(IssueManagement issueManagement)
      Creates a new Model instance using the specified issueManagement.
      Parameters:
      issueManagement - the new IssueManagement to use
      Returns:
      a Model with the specified issueManagement
    • withCiManagement

      @Nonnull public Model withCiManagement(CiManagement ciManagement)
      Creates a new Model instance using the specified ciManagement.
      Parameters:
      ciManagement - the new CiManagement to use
      Returns:
      a Model with the specified ciManagement
    • withBuild

      @Nonnull public Model withBuild(Build build)
      Creates a new Model instance using the specified build.
      Parameters:
      build - the new Build to use
      Returns:
      a Model with the specified build
    • withProfiles

      @Nonnull public Model withProfiles(Collection<Profile> profiles)
      Creates a new Model instance using the specified profiles.
      Parameters:
      profiles - the new Collection<Profile> to use
      Returns:
      a Model with the specified profiles
    • newInstance

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

      @Nonnull public static Model newInstance(boolean withDefaults)
      Creates a new Model 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 Model
    • newBuilder

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

      @Nonnull public static Model.Builder newBuilder(boolean withDefaults)
      Creates a new Model 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 Model.Builder newBuilder(Model from)
      Creates a new Model builder instance using the specified object as a basis. Equivalent to newBuilder(from, false).
      Parameters:
      from - the Model instance to use as a basis
      Returns:
      a new Builder
    • newBuilder

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

      public Path 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

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

      public String toString()
      Overrides:
      toString in class Object
    • isChildProjectUrlInheritAppendPath

      public boolean isChildProjectUrlInheritAppendPath()