Package org.apache.maven.project
Class MavenProject
java.lang.Object
org.apache.maven.project.MavenProject
- All Implemented Interfaces:
Cloneable
The concern of the project is provide runtime values based on the model.
The values in the model remain untouched but during the process of building a
project notions like inheritance and interpolation can be added. This allows
to have an entity which is useful in a runtime while preserving the model so
that it can be marshalled and unmarshalled without being tainted by runtime
requirements. We need to leave the model intact because we don't want
the following:
- We don't want interpolated values being written back into the model.
- We don't want inherited values being written back into the model.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMavenProject
(org.apache.maven.model.Model model) MavenProject
(org.apache.maven.model.Model model, org.codehaus.plexus.logging.Logger logger) MavenProject
(MavenProject project) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttachedArtifact
(org.apache.maven.artifact.Artifact artifact) void
addCompileSourceRoot
(String path) void
addContributor
(org.apache.maven.model.Contributor contributor) void
addDeveloper
(org.apache.maven.model.Developer developer) void
addLicense
(org.apache.maven.model.License license) void
addMailingList
(org.apache.maven.model.MailingList mailingList) void
addPlugin
(org.apache.maven.model.Plugin plugin) void
addProjectReference
(MavenProject project) void
addResource
(org.apache.maven.model.Resource resource) void
addScriptSourceRoot
(String path) void
void
addTestResource
(org.apache.maven.model.Resource testResource) void
attachArtifact
(String type, String classifier, File file) Deprecated.Use MavenProjectHelper.attachArtifact(..) instead.void
void
clone()
createArtifacts
(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, String inheritedScope, org.apache.maven.artifact.resolver.filter.ArtifactFilter dependencyFilter) boolean
org.apache.maven.artifact.Artifact
All dependencies that this project has, including transitive ones.org.apache.maven.model.Build
getBuild()
org.apache.maven.model.CiManagement
Direct dependencies that this project has.org.apache.maven.model.DependencyManagement
org.apache.maven.model.DistributionManagement
org.apache.maven.artifact.repository.ArtifactRepository
org.apache.maven.model.Build
getFile()
org.codehaus.plexus.util.xml.Xpp3Dom
getGoalConfiguration
(String pluginGroupId, String pluginArtifactId, String executionId, String goalId) getId()
org.apache.maven.model.IssueManagement
org.apache.maven.model.Model
getModel()
getModulePathAdjustment
(MavenProject moduleProject) getName()
org.apache.maven.model.Organization
org.apache.maven.model.Build
org.apache.maven.model.Model
org.apache.maven.artifact.Artifact
org.apache.maven.model.PluginManagement
org.apache.maven.model.Prerequisites
Retrieve theProjectBuilderConfiguration
instance used to construct this MavenProject instance.static String
getProjectReferenceId
(String groupId, String artifactId, String version) protected org.apache.maven.artifact.repository.ArtifactRepository
org.codehaus.plexus.util.xml.Xpp3Dom
getReportConfiguration
(String pluginGroupId, String pluginArtifactId, String reportSetId) org.apache.maven.model.Reporting
org.apache.maven.model.Scm
getScm()
protected org.apache.maven.artifact.repository.ArtifactRepository
getUrl()
int
hashCode()
boolean
void
injectPluginManagementInfo
(org.apache.maven.model.Plugin plugin) boolean
boolean
void
void
preserveBuild
(org.apache.maven.model.Build originalInterpolatedBuild) void
preserveCompileSourceRoots
(List originalInterpolatedCompileSourceRoots) void
void
preserveScriptSourceRoots
(List originalInterpolatedScriptSourceRoots) void
preserveTestCompileSourceRoots
(List originalInterpolatedTestCompileSourceRoots) org.apache.maven.artifact.Artifact
replaceWithActiveArtifact
(org.apache.maven.artifact.Artifact pluginArtifact) void
void
setActiveProfiles
(List activeProfiles) void
setArtifact
(org.apache.maven.artifact.Artifact artifact) void
setArtifactId
(String artifactId) void
setArtifacts
(Set artifacts) protected void
setAttachedArtifacts
(List attachedArtifacts) void
setBasedir
(File basedir) void
setBuild
(org.apache.maven.model.Build build) void
setCiManagement
(org.apache.maven.model.CiManagement ciManagement) void
setCollectedProjects
(List collectedProjects) protected void
setCompileSourceRoots
(List compileSourceRoots) void
setConcrete
(boolean concrete) void
setContributors
(List contributors) void
setDependencies
(List dependencies) void
setDependencyArtifacts
(Set dependencyArtifacts) void
setDescription
(String description) void
setDevelopers
(List developers) void
setDistributionManagement
(org.apache.maven.model.DistributionManagement distributionManagement) protected void
setDynamicBuild
(org.apache.maven.model.Build dynamicBuild) protected void
setDynamicCompileSourceRoots
(List dynamicCompileSourceRoots) protected void
setDynamicScriptSourceRoots
(List dynamicScriptSourceRoots) protected void
setDynamicTestCompileSourceRoots
(List dynamicTestCompileSourceRoots) void
setExecutionProject
(MavenProject executionProject) void
setExecutionRoot
(boolean executionRoot) void
setExtensionArtifacts
(Set extensionArtifacts) void
void
setGroupId
(String groupId) void
setInceptionYear
(String inceptionYear) void
setIssueManagement
(org.apache.maven.model.IssueManagement issueManagement) void
setLicenses
(List licenses) void
setLogger
(org.codehaus.plexus.logging.Logger logger) void
setMailingLists
(List mailingLists) void
setManagedVersionMap
(Map map) protected void
setModel
(org.apache.maven.model.Model model) void
setModelVersion
(String pomVersion) void
void
setOrganization
(org.apache.maven.model.Organization organization) protected void
setOriginalInterpolatedBuild
(org.apache.maven.model.Build originalInterpolatedBuild) protected void
setOriginalInterpolatedCompileSourceRoots
(List originalInterpolatedCompileSourceRoots) protected void
setOriginalInterpolatedScriptSourceRoots
(List originalInterpolatedScriptSourceRoots) protected void
setOriginalInterpolatedTestCompileSourceRoots
(List originalInterpolatedTestCompileSourceRoots) void
setOriginalModel
(org.apache.maven.model.Model originalModel) void
setPackaging
(String packaging) void
setParent
(MavenProject parent) void
setParentArtifact
(org.apache.maven.artifact.Artifact parentArtifact) void
setPluginArtifactRepositories
(List pluginArtifactRepositories) void
setPluginArtifacts
(Set pluginArtifacts) void
setProjectBuilderConfiguration
(ProjectBuilderConfiguration projectBuilderConfiguration) Set theProjectBuilderConfiguration
instance used to construct this MavenProject instance.void
setReleaseArtifactRepository
(org.apache.maven.artifact.repository.ArtifactRepository releaseArtifactRepository) void
setRemoteArtifactRepositories
(List remoteArtifactRepositories) void
setReportArtifacts
(Set reportArtifacts) void
setReporting
(org.apache.maven.model.Reporting reporting) void
setScm
(org.apache.maven.model.Scm scm) protected void
setScriptSourceRoots
(List scriptSourceRoots) void
setSnapshotArtifactRepository
(org.apache.maven.artifact.repository.ArtifactRepository snapshotArtifactRepository) protected void
setTestCompileSourceRoots
(List testCompileSourceRoots) void
void
setVersion
(String version) toString()
Default toStringvoid
writeModel
(Writer writer) void
writeOriginalModel
(Writer writer)
-
Field Details
-
EMPTY_PROJECT_GROUP_ID
- See Also:
-
EMPTY_PROJECT_ARTIFACT_ID
- See Also:
-
EMPTY_PROJECT_VERSION
- See Also:
-
-
Constructor Details
-
MavenProject
public MavenProject() -
MavenProject
public MavenProject(org.apache.maven.model.Model model) -
MavenProject
public MavenProject(org.apache.maven.model.Model model, org.codehaus.plexus.logging.Logger logger) -
MavenProject
Deprecated.useclone()
so subclasses can provide a copy of the same class
-
-
Method Details
-
getModulePathAdjustment
- Throws:
IOException
-
getArtifact
public org.apache.maven.artifact.Artifact getArtifact() -
setArtifact
public void setArtifact(org.apache.maven.artifact.Artifact artifact) -
getModel
public org.apache.maven.model.Model getModel() -
getParent
-
setParent
-
setRemoteArtifactRepositories
-
getRemoteArtifactRepositories
-
hasParent
public boolean hasParent() -
getFile
-
setFile
-
setBasedir
-
getBasedir
-
setDependencies
-
getDependencies
-
getDependencyManagement
public org.apache.maven.model.DependencyManagement getDependencyManagement() -
addCompileSourceRoot
-
addScriptSourceRoot
-
addTestCompileSourceRoot
-
getCompileSourceRoots
-
getScriptSourceRoots
-
getTestCompileSourceRoots
-
getCompileClasspathElements
public List getCompileClasspathElements() throws org.apache.maven.artifact.DependencyResolutionRequiredException- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException
-
getCompileArtifacts
-
getCompileDependencies
-
getTestClasspathElements
public List getTestClasspathElements() throws org.apache.maven.artifact.DependencyResolutionRequiredException- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException
-
getTestArtifacts
-
getTestDependencies
-
getRuntimeClasspathElements
public List getRuntimeClasspathElements() throws org.apache.maven.artifact.DependencyResolutionRequiredException- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException
-
getRuntimeArtifacts
-
getRuntimeDependencies
-
getSystemClasspathElements
public List getSystemClasspathElements() throws org.apache.maven.artifact.DependencyResolutionRequiredException- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException
-
getSystemArtifacts
-
getSystemDependencies
-
setModelVersion
-
getModelVersion
-
getId
-
setGroupId
-
getGroupId
-
setArtifactId
-
getArtifactId
-
setName
-
getName
-
setVersion
-
getVersion
-
getPackaging
-
setPackaging
-
setInceptionYear
-
getInceptionYear
-
setUrl
-
getUrl
-
getPrerequisites
public org.apache.maven.model.Prerequisites getPrerequisites() -
setIssueManagement
public void setIssueManagement(org.apache.maven.model.IssueManagement issueManagement) -
getCiManagement
public org.apache.maven.model.CiManagement getCiManagement() -
setCiManagement
public void setCiManagement(org.apache.maven.model.CiManagement ciManagement) -
getIssueManagement
public org.apache.maven.model.IssueManagement getIssueManagement() -
setDistributionManagement
public void setDistributionManagement(org.apache.maven.model.DistributionManagement distributionManagement) -
getDistributionManagement
public org.apache.maven.model.DistributionManagement getDistributionManagement() -
setDescription
-
getDescription
-
setOrganization
public void setOrganization(org.apache.maven.model.Organization organization) -
getOrganization
public org.apache.maven.model.Organization getOrganization() -
setScm
public void setScm(org.apache.maven.model.Scm scm) -
getScm
public org.apache.maven.model.Scm getScm() -
setMailingLists
-
getMailingLists
-
addMailingList
public void addMailingList(org.apache.maven.model.MailingList mailingList) -
setDevelopers
-
getDevelopers
-
addDeveloper
public void addDeveloper(org.apache.maven.model.Developer developer) -
setContributors
-
getContributors
-
addContributor
public void addContributor(org.apache.maven.model.Contributor contributor) -
setBuild
public void setBuild(org.apache.maven.model.Build build) -
getBuild
public org.apache.maven.model.Build getBuild() -
getResources
-
getTestResources
-
addResource
public void addResource(org.apache.maven.model.Resource resource) -
addTestResource
public void addTestResource(org.apache.maven.model.Resource testResource) -
setReporting
public void setReporting(org.apache.maven.model.Reporting reporting) -
getReporting
public org.apache.maven.model.Reporting getReporting() -
setLicenses
-
getLicenses
-
addLicense
public void addLicense(org.apache.maven.model.License license) -
setArtifacts
-
getArtifacts
All dependencies that this project has, including transitive ones. Contents are lazily populated, so depending on what phases have run dependencies in some scopes won't be included. eg. if only compile phase has run, dependencies with scope test won't be included.- Returns:
Set
<Artifact
>- See Also:
-
getArtifactMap
-
setPluginArtifacts
-
getPluginArtifacts
-
getPluginArtifactMap
-
setReportArtifacts
-
getReportArtifacts
-
getReportArtifactMap
-
setExtensionArtifacts
-
getExtensionArtifacts
-
getExtensionArtifactMap
-
setParentArtifact
public void setParentArtifact(org.apache.maven.artifact.Artifact parentArtifact) -
getParentArtifact
public org.apache.maven.artifact.Artifact getParentArtifact() -
getRepositories
-
getReportPlugins
-
getBuildPlugins
-
getModules
-
getPluginManagement
public org.apache.maven.model.PluginManagement getPluginManagement() -
addPlugin
public void addPlugin(org.apache.maven.model.Plugin plugin) -
injectPluginManagementInfo
public void injectPluginManagementInfo(org.apache.maven.model.Plugin plugin) -
getCollectedProjects
-
setCollectedProjects
-
setPluginArtifactRepositories
-
getPluginArtifactRepositories
- Returns:
- a list of ArtifactRepository objects constructed from the Repository objects returned by getPluginRepositories.
-
getDistributionManagementArtifactRepository
public org.apache.maven.artifact.repository.ArtifactRepository getDistributionManagementArtifactRepository() -
getPluginRepositories
-
setActiveProfiles
-
getActiveProfiles
-
addAttachedArtifact
public void addAttachedArtifact(org.apache.maven.artifact.Artifact artifact) -
getAttachedArtifacts
-
getGoalConfiguration
-
getReportConfiguration
-
getExecutionProject
-
setExecutionProject
-
writeModel
- Throws:
IOException
-
writeOriginalModel
- Throws:
IOException
-
getDependencyArtifacts
Direct dependencies that this project has.- Returns:
Set
<Artifact
>- See Also:
-
setDependencyArtifacts
-
setReleaseArtifactRepository
public void setReleaseArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository releaseArtifactRepository) -
setSnapshotArtifactRepository
public void setSnapshotArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository snapshotArtifactRepository) -
setOriginalModel
public void setOriginalModel(org.apache.maven.model.Model originalModel) -
getOriginalModel
public org.apache.maven.model.Model getOriginalModel() -
setManagedVersionMap
-
getManagedVersionMap
-
equals
-
hashCode
public int hashCode() -
getBuildExtensions
-
createArtifacts
public Set createArtifacts(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, String inheritedScope, org.apache.maven.artifact.resolver.filter.ArtifactFilter dependencyFilter) throws InvalidDependencyVersionException - Returns:
Set
<Artifact
>- Throws:
InvalidDependencyVersionException
-
addProjectReference
-
getProjectReferenceId
-
attachArtifact
Deprecated.Use MavenProjectHelper.attachArtifact(..) instead. -
getProperties
-
getFilters
-
getProjectReferences
-
isExecutionRoot
public boolean isExecutionRoot() -
setExecutionRoot
public void setExecutionRoot(boolean executionRoot) -
getDefaultGoal
-
setModel
protected void setModel(org.apache.maven.model.Model model) -
setAttachedArtifacts
-
setCompileSourceRoots
-
setTestCompileSourceRoots
-
setScriptSourceRoots
-
getReleaseArtifactRepository
protected org.apache.maven.artifact.repository.ArtifactRepository getReleaseArtifactRepository() -
getSnapshotArtifactRepository
protected org.apache.maven.artifact.repository.ArtifactRepository getSnapshotArtifactRepository() -
resolveActiveArtifacts
public void resolveActiveArtifacts() -
replaceWithActiveArtifact
public org.apache.maven.artifact.Artifact replaceWithActiveArtifact(org.apache.maven.artifact.Artifact pluginArtifact) -
toString
Default toString -
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
- Since:
- 2.0.9
-
isConcrete
public boolean isConcrete() -
setConcrete
public void setConcrete(boolean concrete) -
getDynamicBuild
public org.apache.maven.model.Build getDynamicBuild() -
getOriginalInterpolatedBuild
public org.apache.maven.model.Build getOriginalInterpolatedBuild() -
getDynamicCompileSourceRoots
-
getOriginalInterpolatedCompileSourceRoots
-
getDynamicTestCompileSourceRoots
-
getOriginalInterpolatedTestCompileSourceRoots
-
getDynamicScriptSourceRoots
-
getOriginalInterpolatedScriptSourceRoots
-
clearRestorableRoots
public void clearRestorableRoots() -
clearRestorableBuild
public void clearRestorableBuild() -
preserveCompileSourceRoots
-
preserveTestCompileSourceRoots
-
preserveScriptSourceRoots
-
preserveBuild
public void preserveBuild(org.apache.maven.model.Build originalInterpolatedBuild) -
setDynamicBuild
protected void setDynamicBuild(org.apache.maven.model.Build dynamicBuild) -
setOriginalInterpolatedBuild
protected void setOriginalInterpolatedBuild(org.apache.maven.model.Build originalInterpolatedBuild) -
setDynamicCompileSourceRoots
-
setOriginalInterpolatedCompileSourceRoots
protected void setOriginalInterpolatedCompileSourceRoots(List originalInterpolatedCompileSourceRoots) -
setDynamicTestCompileSourceRoots
-
setOriginalInterpolatedTestCompileSourceRoots
protected void setOriginalInterpolatedTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots) -
setDynamicScriptSourceRoots
-
setOriginalInterpolatedScriptSourceRoots
-
getPreservedProperties
-
preserveProperties
public void preserveProperties() -
getPreservedBasedir
-
preserveBasedir
public void preserveBasedir() -
setLogger
public void setLogger(org.codehaus.plexus.logging.Logger logger) -
getProjectBuilderConfiguration
Retrieve theProjectBuilderConfiguration
instance used to construct this MavenProject instance. -
setProjectBuilderConfiguration
Set theProjectBuilderConfiguration
instance used to construct this MavenProject instance.- Parameters:
projectBuilderConfiguration
-
-
clone()
so subclasses can provide a copy of the same class