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 TypeMethodDescriptionvoidaddAttachedArtifact(org.apache.maven.artifact.Artifact artifact) voidaddCompileSourceRoot(String path) voidaddContributor(org.apache.maven.model.Contributor contributor) voidaddDeveloper(org.apache.maven.model.Developer developer) voidaddLicense(org.apache.maven.model.License license) voidaddMailingList(org.apache.maven.model.MailingList mailingList) voidaddPlugin(org.apache.maven.model.Plugin plugin) voidaddProjectReference(MavenProject project) voidaddResource(org.apache.maven.model.Resource resource) voidaddScriptSourceRoot(String path) voidvoidaddTestResource(org.apache.maven.model.Resource testResource) voidattachArtifact(String type, String classifier, File file) Deprecated.Use MavenProjectHelper.attachArtifact(..) instead.voidvoidclone()createArtifacts(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory, String inheritedScope, org.apache.maven.artifact.resolver.filter.ArtifactFilter dependencyFilter) booleanorg.apache.maven.artifact.ArtifactAll dependencies that this project has, including transitive ones.org.apache.maven.model.BuildgetBuild()org.apache.maven.model.CiManagementDirect dependencies that this project has.org.apache.maven.model.DependencyManagementorg.apache.maven.model.DistributionManagementorg.apache.maven.artifact.repository.ArtifactRepositoryorg.apache.maven.model.BuildgetFile()org.codehaus.plexus.util.xml.Xpp3DomgetGoalConfiguration(String pluginGroupId, String pluginArtifactId, String executionId, String goalId) getId()org.apache.maven.model.IssueManagementorg.apache.maven.model.ModelgetModel()getModulePathAdjustment(MavenProject moduleProject) getName()org.apache.maven.model.Organizationorg.apache.maven.model.Buildorg.apache.maven.model.Modelorg.apache.maven.artifact.Artifactorg.apache.maven.model.PluginManagementorg.apache.maven.model.PrerequisitesRetrieve theProjectBuilderConfigurationinstance used to construct this MavenProject instance.static StringgetProjectReferenceId(String groupId, String artifactId, String version) protected org.apache.maven.artifact.repository.ArtifactRepositoryorg.codehaus.plexus.util.xml.Xpp3DomgetReportConfiguration(String pluginGroupId, String pluginArtifactId, String reportSetId) org.apache.maven.model.Reportingorg.apache.maven.model.ScmgetScm()protected org.apache.maven.artifact.repository.ArtifactRepositorygetUrl()inthashCode()booleanvoidinjectPluginManagementInfo(org.apache.maven.model.Plugin plugin) booleanbooleanvoidvoidpreserveBuild(org.apache.maven.model.Build originalInterpolatedBuild) voidpreserveCompileSourceRoots(List originalInterpolatedCompileSourceRoots) voidvoidpreserveScriptSourceRoots(List originalInterpolatedScriptSourceRoots) voidpreserveTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots) org.apache.maven.artifact.ArtifactreplaceWithActiveArtifact(org.apache.maven.artifact.Artifact pluginArtifact) voidvoidsetActiveProfiles(List activeProfiles) voidsetArtifact(org.apache.maven.artifact.Artifact artifact) voidsetArtifactId(String artifactId) voidsetArtifacts(Set artifacts) protected voidsetAttachedArtifacts(List attachedArtifacts) voidsetBasedir(File basedir) voidsetBuild(org.apache.maven.model.Build build) voidsetCiManagement(org.apache.maven.model.CiManagement ciManagement) voidsetCollectedProjects(List collectedProjects) protected voidsetCompileSourceRoots(List compileSourceRoots) voidsetConcrete(boolean concrete) voidsetContributors(List contributors) voidsetDependencies(List dependencies) voidsetDependencyArtifacts(Set dependencyArtifacts) voidsetDescription(String description) voidsetDevelopers(List developers) voidsetDistributionManagement(org.apache.maven.model.DistributionManagement distributionManagement) protected voidsetDynamicBuild(org.apache.maven.model.Build dynamicBuild) protected voidsetDynamicCompileSourceRoots(List dynamicCompileSourceRoots) protected voidsetDynamicScriptSourceRoots(List dynamicScriptSourceRoots) protected voidsetDynamicTestCompileSourceRoots(List dynamicTestCompileSourceRoots) voidsetExecutionProject(MavenProject executionProject) voidsetExecutionRoot(boolean executionRoot) voidsetExtensionArtifacts(Set extensionArtifacts) voidvoidsetGroupId(String groupId) voidsetInceptionYear(String inceptionYear) voidsetIssueManagement(org.apache.maven.model.IssueManagement issueManagement) voidsetLicenses(List licenses) voidsetLogger(org.codehaus.plexus.logging.Logger logger) voidsetMailingLists(List mailingLists) voidsetManagedVersionMap(Map map) protected voidsetModel(org.apache.maven.model.Model model) voidsetModelVersion(String pomVersion) voidvoidsetOrganization(org.apache.maven.model.Organization organization) protected voidsetOriginalInterpolatedBuild(org.apache.maven.model.Build originalInterpolatedBuild) protected voidsetOriginalInterpolatedCompileSourceRoots(List originalInterpolatedCompileSourceRoots) protected voidsetOriginalInterpolatedScriptSourceRoots(List originalInterpolatedScriptSourceRoots) protected voidsetOriginalInterpolatedTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots) voidsetOriginalModel(org.apache.maven.model.Model originalModel) voidsetPackaging(String packaging) voidsetParent(MavenProject parent) voidsetParentArtifact(org.apache.maven.artifact.Artifact parentArtifact) voidsetPluginArtifactRepositories(List pluginArtifactRepositories) voidsetPluginArtifacts(Set pluginArtifacts) voidsetProjectBuilderConfiguration(ProjectBuilderConfiguration projectBuilderConfiguration) Set theProjectBuilderConfigurationinstance used to construct this MavenProject instance.voidsetReleaseArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository releaseArtifactRepository) voidsetRemoteArtifactRepositories(List remoteArtifactRepositories) voidsetReportArtifacts(Set reportArtifacts) voidsetReporting(org.apache.maven.model.Reporting reporting) voidsetScm(org.apache.maven.model.Scm scm) protected voidsetScriptSourceRoots(List scriptSourceRoots) voidsetSnapshotArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository snapshotArtifactRepository) protected voidsetTestCompileSourceRoots(List testCompileSourceRoots) voidvoidsetVersion(String version) toString()Default toStringvoidwriteModel(Writer writer) voidwriteOriginalModel(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
-
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
-
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
-
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
-
clone
- Overrides:
clonein 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 theProjectBuilderConfigurationinstance used to construct this MavenProject instance. -
setProjectBuilderConfiguration
Set theProjectBuilderConfigurationinstance used to construct this MavenProject instance.- Parameters:
projectBuilderConfiguration-
-
clone()so subclasses can provide a copy of the same class