org.apache.maven.project
Class MavenProject
java.lang.Object
org.apache.maven.project.MavenProject
- All Implemented Interfaces:
- Cloneable
public class MavenProject
- extends Object
- implements 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.
Method Summary |
void |
addAttachedArtifact(Artifact artifact)
|
void |
addCompileSourceRoot(String path)
|
void |
addContributor(Contributor contributor)
|
void |
addDeveloper(Developer developer)
|
void |
addLicense(License license)
|
void |
addMailingList(MailingList mailingList)
|
void |
addPlugin(Plugin plugin)
|
void |
addProjectReference(MavenProject project)
|
void |
addResource(Resource resource)
|
void |
addScriptSourceRoot(String path)
|
void |
addTestCompileSourceRoot(String path)
|
void |
addTestResource(Resource testResource)
|
void |
attachArtifact(String type,
String classifier,
File file)
Deprecated. Use MavenProjectHelper.attachArtifact(..) instead. |
void |
clearRestorableBuild()
|
void |
clearRestorableRoots()
|
Object |
clone()
|
Set |
createArtifacts(ArtifactFactory artifactFactory,
String inheritedScope,
ArtifactFilter dependencyFilter)
|
boolean |
equals(Object other)
|
List |
getActiveProfiles()
|
Artifact |
getArtifact()
|
String |
getArtifactId()
|
Map |
getArtifactMap()
|
Set |
getArtifacts()
All dependencies that this project has, including transitive ones. |
List |
getAttachedArtifacts()
|
File |
getBasedir()
|
Build |
getBuild()
|
List |
getBuildExtensions()
|
List |
getBuildPlugins()
|
CiManagement |
getCiManagement()
|
List |
getCollectedProjects()
|
List |
getCompileArtifacts()
|
List |
getCompileClasspathElements()
|
List |
getCompileDependencies()
|
List |
getCompileSourceRoots()
|
List |
getContributors()
|
String |
getDefaultGoal()
|
List |
getDependencies()
|
Set |
getDependencyArtifacts()
Direct dependencies that this project has. |
DependencyManagement |
getDependencyManagement()
|
String |
getDescription()
|
List |
getDevelopers()
|
DistributionManagement |
getDistributionManagement()
|
ArtifactRepository |
getDistributionManagementArtifactRepository()
|
Build |
getDynamicBuild()
|
List |
getDynamicCompileSourceRoots()
|
List |
getDynamicScriptSourceRoots()
|
List |
getDynamicTestCompileSourceRoots()
|
MavenProject |
getExecutionProject()
|
Map |
getExtensionArtifactMap()
|
Set |
getExtensionArtifacts()
|
File |
getFile()
|
List |
getFilters()
|
org.codehaus.plexus.util.xml.Xpp3Dom |
getGoalConfiguration(String pluginGroupId,
String pluginArtifactId,
String executionId,
String goalId)
|
String |
getGroupId()
|
String |
getId()
|
String |
getInceptionYear()
|
IssueManagement |
getIssueManagement()
|
List |
getLicenses()
|
List |
getMailingLists()
|
Map |
getManagedVersionMap()
|
Model |
getModel()
|
String |
getModelVersion()
|
String |
getModulePathAdjustment(MavenProject moduleProject)
|
List |
getModules()
|
String |
getName()
|
Organization |
getOrganization()
|
Build |
getOriginalInterpolatedBuild()
|
List |
getOriginalInterpolatedCompileSourceRoots()
|
List |
getOriginalInterpolatedScriptSourceRoots()
|
List |
getOriginalInterpolatedTestCompileSourceRoots()
|
Model |
getOriginalModel()
|
String |
getPackaging()
|
MavenProject |
getParent()
|
Artifact |
getParentArtifact()
|
Map |
getPluginArtifactMap()
|
List |
getPluginArtifactRepositories()
|
Set |
getPluginArtifacts()
|
PluginManagement |
getPluginManagement()
|
List |
getPluginRepositories()
|
Prerequisites |
getPrerequisites()
|
File |
getPreservedBasedir()
|
Properties |
getPreservedProperties()
|
ProjectBuilderConfiguration |
getProjectBuilderConfiguration()
Retrieve the ProjectBuilderConfiguration instance used to construct this MavenProject instance. |
static String |
getProjectReferenceId(String groupId,
String artifactId,
String version)
|
Map |
getProjectReferences()
|
Properties |
getProperties()
|
protected ArtifactRepository |
getReleaseArtifactRepository()
|
List |
getRemoteArtifactRepositories()
|
Map |
getReportArtifactMap()
|
Set |
getReportArtifacts()
|
org.codehaus.plexus.util.xml.Xpp3Dom |
getReportConfiguration(String pluginGroupId,
String pluginArtifactId,
String reportSetId)
|
Reporting |
getReporting()
|
List |
getReportPlugins()
|
List |
getRepositories()
|
List |
getResources()
|
List |
getRuntimeArtifacts()
|
List |
getRuntimeClasspathElements()
|
List |
getRuntimeDependencies()
|
Scm |
getScm()
|
List |
getScriptSourceRoots()
|
protected ArtifactRepository |
getSnapshotArtifactRepository()
|
List |
getSystemArtifacts()
|
List |
getSystemClasspathElements()
|
List |
getSystemDependencies()
|
List |
getTestArtifacts()
|
List |
getTestClasspathElements()
|
List |
getTestCompileSourceRoots()
|
List |
getTestDependencies()
|
List |
getTestResources()
|
String |
getUrl()
|
String |
getVersion()
|
int |
hashCode()
|
boolean |
hasParent()
|
void |
injectPluginManagementInfo(Plugin plugin)
|
boolean |
isConcrete()
|
boolean |
isExecutionRoot()
|
void |
preserveBasedir()
|
void |
preserveBuild(Build originalInterpolatedBuild)
|
void |
preserveCompileSourceRoots(List originalInterpolatedCompileSourceRoots)
|
void |
preserveProperties()
|
void |
preserveScriptSourceRoots(List originalInterpolatedScriptSourceRoots)
|
void |
preserveTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots)
|
Artifact |
replaceWithActiveArtifact(Artifact pluginArtifact)
|
void |
resolveActiveArtifacts()
|
void |
setActiveProfiles(List activeProfiles)
|
void |
setArtifact(Artifact artifact)
|
void |
setArtifactId(String artifactId)
|
void |
setArtifacts(Set artifacts)
|
protected void |
setAttachedArtifacts(List attachedArtifacts)
|
void |
setBasedir(File basedir)
|
void |
setBuild(Build build)
|
void |
setCiManagement(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(DistributionManagement distributionManagement)
|
protected void |
setDynamicBuild(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 |
setFile(File file)
|
void |
setGroupId(String groupId)
|
void |
setInceptionYear(String inceptionYear)
|
void |
setIssueManagement(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(Model model)
|
void |
setModelVersion(String pomVersion)
|
void |
setName(String name)
|
void |
setOrganization(Organization organization)
|
protected void |
setOriginalInterpolatedBuild(Build originalInterpolatedBuild)
|
protected void |
setOriginalInterpolatedCompileSourceRoots(List originalInterpolatedCompileSourceRoots)
|
protected void |
setOriginalInterpolatedScriptSourceRoots(List originalInterpolatedScriptSourceRoots)
|
protected void |
setOriginalInterpolatedTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots)
|
void |
setOriginalModel(Model originalModel)
|
void |
setPackaging(String packaging)
|
void |
setParent(MavenProject parent)
|
void |
setParentArtifact(Artifact parentArtifact)
|
void |
setPluginArtifactRepositories(List pluginArtifactRepositories)
|
void |
setPluginArtifacts(Set pluginArtifacts)
|
void |
setProjectBuilderConfiguration(ProjectBuilderConfiguration projectBuilderConfiguration)
Set the ProjectBuilderConfiguration instance used to construct this MavenProject instance. |
void |
setReleaseArtifactRepository(ArtifactRepository releaseArtifactRepository)
|
void |
setRemoteArtifactRepositories(List remoteArtifactRepositories)
|
void |
setReportArtifacts(Set reportArtifacts)
|
void |
setReporting(Reporting reporting)
|
void |
setScm(Scm scm)
|
protected void |
setScriptSourceRoots(List scriptSourceRoots)
|
void |
setSnapshotArtifactRepository(ArtifactRepository snapshotArtifactRepository)
|
protected void |
setTestCompileSourceRoots(List testCompileSourceRoots)
|
void |
setUrl(String url)
|
void |
setVersion(String version)
|
String |
toString()
Default toString |
void |
writeModel(Writer writer)
|
void |
writeOriginalModel(Writer writer)
|
EMPTY_PROJECT_GROUP_ID
public static final String EMPTY_PROJECT_GROUP_ID
- See Also:
- Constant Field Values
EMPTY_PROJECT_ARTIFACT_ID
public static final String EMPTY_PROJECT_ARTIFACT_ID
- See Also:
- Constant Field Values
EMPTY_PROJECT_VERSION
public static final String EMPTY_PROJECT_VERSION
- See Also:
- Constant Field Values
MavenProject
public MavenProject()
MavenProject
public MavenProject(Model model)
MavenProject
public MavenProject(Model model,
org.codehaus.plexus.logging.Logger logger)
MavenProject
public MavenProject(MavenProject project)
- Deprecated. use
clone()
so subclasses can provide a copy of the same class
getModulePathAdjustment
public String getModulePathAdjustment(MavenProject moduleProject)
throws IOException
- Throws:
IOException
getArtifact
public Artifact getArtifact()
setArtifact
public void setArtifact(Artifact artifact)
getModel
public Model getModel()
getParent
public MavenProject getParent()
setParent
public void setParent(MavenProject parent)
setRemoteArtifactRepositories
public void setRemoteArtifactRepositories(List remoteArtifactRepositories)
getRemoteArtifactRepositories
public List getRemoteArtifactRepositories()
hasParent
public boolean hasParent()
getFile
public File getFile()
setFile
public void setFile(File file)
setBasedir
public void setBasedir(File basedir)
getBasedir
public File getBasedir()
setDependencies
public void setDependencies(List dependencies)
getDependencies
public List getDependencies()
getDependencyManagement
public DependencyManagement getDependencyManagement()
addCompileSourceRoot
public void addCompileSourceRoot(String path)
addScriptSourceRoot
public void addScriptSourceRoot(String path)
addTestCompileSourceRoot
public void addTestCompileSourceRoot(String path)
getCompileSourceRoots
public List getCompileSourceRoots()
getScriptSourceRoots
public List getScriptSourceRoots()
getTestCompileSourceRoots
public List getTestCompileSourceRoots()
getCompileClasspathElements
public List getCompileClasspathElements()
throws DependencyResolutionRequiredException
- Throws:
DependencyResolutionRequiredException
getCompileArtifacts
public List getCompileArtifacts()
getCompileDependencies
public List getCompileDependencies()
getTestClasspathElements
public List getTestClasspathElements()
throws DependencyResolutionRequiredException
- Throws:
DependencyResolutionRequiredException
getTestArtifacts
public List getTestArtifacts()
getTestDependencies
public List getTestDependencies()
getRuntimeClasspathElements
public List getRuntimeClasspathElements()
throws DependencyResolutionRequiredException
- Throws:
DependencyResolutionRequiredException
getRuntimeArtifacts
public List getRuntimeArtifacts()
getRuntimeDependencies
public List getRuntimeDependencies()
getSystemClasspathElements
public List getSystemClasspathElements()
throws DependencyResolutionRequiredException
- Throws:
DependencyResolutionRequiredException
getSystemArtifacts
public List getSystemArtifacts()
getSystemDependencies
public List getSystemDependencies()
setModelVersion
public void setModelVersion(String pomVersion)
getModelVersion
public String getModelVersion()
getId
public String getId()
setGroupId
public void setGroupId(String groupId)
getGroupId
public String getGroupId()
setArtifactId
public void setArtifactId(String artifactId)
getArtifactId
public String getArtifactId()
setName
public void setName(String name)
getName
public String getName()
setVersion
public void setVersion(String version)
getVersion
public String getVersion()
getPackaging
public String getPackaging()
setPackaging
public void setPackaging(String packaging)
setInceptionYear
public void setInceptionYear(String inceptionYear)
getInceptionYear
public String getInceptionYear()
setUrl
public void setUrl(String url)
getUrl
public String getUrl()
getPrerequisites
public Prerequisites getPrerequisites()
setIssueManagement
public void setIssueManagement(IssueManagement issueManagement)
getCiManagement
public CiManagement getCiManagement()
setCiManagement
public void setCiManagement(CiManagement ciManagement)
getIssueManagement
public IssueManagement getIssueManagement()
setDistributionManagement
public void setDistributionManagement(DistributionManagement distributionManagement)
getDistributionManagement
public DistributionManagement getDistributionManagement()
setDescription
public void setDescription(String description)
getDescription
public String getDescription()
setOrganization
public void setOrganization(Organization organization)
getOrganization
public Organization getOrganization()
setScm
public void setScm(Scm scm)
getScm
public Scm getScm()
setMailingLists
public void setMailingLists(List mailingLists)
getMailingLists
public List getMailingLists()
addMailingList
public void addMailingList(MailingList mailingList)
setDevelopers
public void setDevelopers(List developers)
getDevelopers
public List getDevelopers()
addDeveloper
public void addDeveloper(Developer developer)
setContributors
public void setContributors(List contributors)
getContributors
public List getContributors()
addContributor
public void addContributor(Contributor contributor)
setBuild
public void setBuild(Build build)
getBuild
public Build getBuild()
getResources
public List getResources()
getTestResources
public List getTestResources()
addResource
public void addResource(Resource resource)
addTestResource
public void addTestResource(Resource testResource)
setReporting
public void setReporting(Reporting reporting)
getReporting
public Reporting getReporting()
setLicenses
public void setLicenses(List licenses)
getLicenses
public List getLicenses()
addLicense
public void addLicense(License license)
setArtifacts
public void setArtifacts(Set artifacts)
getArtifacts
public Set 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:
to get only direct dependencies
getArtifactMap
public Map getArtifactMap()
setPluginArtifacts
public void setPluginArtifacts(Set pluginArtifacts)
getPluginArtifacts
public Set getPluginArtifacts()
getPluginArtifactMap
public Map getPluginArtifactMap()
setReportArtifacts
public void setReportArtifacts(Set reportArtifacts)
getReportArtifacts
public Set getReportArtifacts()
getReportArtifactMap
public Map getReportArtifactMap()
setExtensionArtifacts
public void setExtensionArtifacts(Set extensionArtifacts)
getExtensionArtifacts
public Set getExtensionArtifacts()
getExtensionArtifactMap
public Map getExtensionArtifactMap()
setParentArtifact
public void setParentArtifact(Artifact parentArtifact)
getParentArtifact
public Artifact getParentArtifact()
getRepositories
public List getRepositories()
getReportPlugins
public List getReportPlugins()
getBuildPlugins
public List getBuildPlugins()
getModules
public List getModules()
getPluginManagement
public PluginManagement getPluginManagement()
addPlugin
public void addPlugin(Plugin plugin)
injectPluginManagementInfo
public void injectPluginManagementInfo(Plugin plugin)
getCollectedProjects
public List getCollectedProjects()
setCollectedProjects
public void setCollectedProjects(List collectedProjects)
setPluginArtifactRepositories
public void setPluginArtifactRepositories(List pluginArtifactRepositories)
getPluginArtifactRepositories
public List getPluginArtifactRepositories()
- Returns:
- a list of ArtifactRepository objects constructed
from the Repository objects returned by getPluginRepositories.
getDistributionManagementArtifactRepository
public ArtifactRepository getDistributionManagementArtifactRepository()
getPluginRepositories
public List getPluginRepositories()
setActiveProfiles
public void setActiveProfiles(List activeProfiles)
getActiveProfiles
public List getActiveProfiles()
addAttachedArtifact
public void addAttachedArtifact(Artifact artifact)
getAttachedArtifacts
public List getAttachedArtifacts()
getGoalConfiguration
public org.codehaus.plexus.util.xml.Xpp3Dom getGoalConfiguration(String pluginGroupId,
String pluginArtifactId,
String executionId,
String goalId)
getReportConfiguration
public org.codehaus.plexus.util.xml.Xpp3Dom getReportConfiguration(String pluginGroupId,
String pluginArtifactId,
String reportSetId)
getExecutionProject
public MavenProject getExecutionProject()
setExecutionProject
public void setExecutionProject(MavenProject executionProject)
writeModel
public void writeModel(Writer writer)
throws IOException
- Throws:
IOException
writeOriginalModel
public void writeOriginalModel(Writer writer)
throws IOException
- Throws:
IOException
getDependencyArtifacts
public Set getDependencyArtifacts()
- Direct dependencies that this project has.
- Returns:
Set
< Artifact
>- See Also:
to get all transitive dependencies
setDependencyArtifacts
public void setDependencyArtifacts(Set dependencyArtifacts)
setReleaseArtifactRepository
public void setReleaseArtifactRepository(ArtifactRepository releaseArtifactRepository)
setSnapshotArtifactRepository
public void setSnapshotArtifactRepository(ArtifactRepository snapshotArtifactRepository)
setOriginalModel
public void setOriginalModel(Model originalModel)
getOriginalModel
public Model getOriginalModel()
setManagedVersionMap
public void setManagedVersionMap(Map map)
getManagedVersionMap
public Map getManagedVersionMap()
equals
public boolean equals(Object other)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
getBuildExtensions
public List getBuildExtensions()
createArtifacts
public Set createArtifacts(ArtifactFactory artifactFactory,
String inheritedScope,
ArtifactFilter dependencyFilter)
throws InvalidDependencyVersionException
- Returns:
Set
< Artifact
>
- Throws:
InvalidDependencyVersionException
addProjectReference
public void addProjectReference(MavenProject project)
getProjectReferenceId
public static String getProjectReferenceId(String groupId,
String artifactId,
String version)
attachArtifact
public void attachArtifact(String type,
String classifier,
File file)
- Deprecated. Use MavenProjectHelper.attachArtifact(..) instead.
getProperties
public Properties getProperties()
getFilters
public List getFilters()
getProjectReferences
public Map getProjectReferences()
isExecutionRoot
public boolean isExecutionRoot()
setExecutionRoot
public void setExecutionRoot(boolean executionRoot)
getDefaultGoal
public String getDefaultGoal()
setModel
protected void setModel(Model model)
setAttachedArtifacts
protected void setAttachedArtifacts(List attachedArtifacts)
setCompileSourceRoots
protected void setCompileSourceRoots(List compileSourceRoots)
setTestCompileSourceRoots
protected void setTestCompileSourceRoots(List testCompileSourceRoots)
setScriptSourceRoots
protected void setScriptSourceRoots(List scriptSourceRoots)
getReleaseArtifactRepository
protected ArtifactRepository getReleaseArtifactRepository()
getSnapshotArtifactRepository
protected ArtifactRepository getSnapshotArtifactRepository()
resolveActiveArtifacts
public void resolveActiveArtifacts()
replaceWithActiveArtifact
public Artifact replaceWithActiveArtifact(Artifact pluginArtifact)
toString
public String toString()
- Default toString
- Overrides:
toString
in class Object
clone
public Object clone()
throws CloneNotSupportedException
- Overrides:
clone
in class Object
- Throws:
CloneNotSupportedException
- Since:
- 2.0.9
isConcrete
public boolean isConcrete()
setConcrete
public void setConcrete(boolean concrete)
getDynamicBuild
public Build getDynamicBuild()
getOriginalInterpolatedBuild
public Build getOriginalInterpolatedBuild()
getDynamicCompileSourceRoots
public List getDynamicCompileSourceRoots()
getOriginalInterpolatedCompileSourceRoots
public List getOriginalInterpolatedCompileSourceRoots()
getDynamicTestCompileSourceRoots
public List getDynamicTestCompileSourceRoots()
getOriginalInterpolatedTestCompileSourceRoots
public List getOriginalInterpolatedTestCompileSourceRoots()
getDynamicScriptSourceRoots
public List getDynamicScriptSourceRoots()
getOriginalInterpolatedScriptSourceRoots
public List getOriginalInterpolatedScriptSourceRoots()
clearRestorableRoots
public void clearRestorableRoots()
clearRestorableBuild
public void clearRestorableBuild()
preserveCompileSourceRoots
public void preserveCompileSourceRoots(List originalInterpolatedCompileSourceRoots)
preserveTestCompileSourceRoots
public void preserveTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots)
preserveScriptSourceRoots
public void preserveScriptSourceRoots(List originalInterpolatedScriptSourceRoots)
preserveBuild
public void preserveBuild(Build originalInterpolatedBuild)
setDynamicBuild
protected void setDynamicBuild(Build dynamicBuild)
setOriginalInterpolatedBuild
protected void setOriginalInterpolatedBuild(Build originalInterpolatedBuild)
setDynamicCompileSourceRoots
protected void setDynamicCompileSourceRoots(List dynamicCompileSourceRoots)
setOriginalInterpolatedCompileSourceRoots
protected void setOriginalInterpolatedCompileSourceRoots(List originalInterpolatedCompileSourceRoots)
setDynamicTestCompileSourceRoots
protected void setDynamicTestCompileSourceRoots(List dynamicTestCompileSourceRoots)
setOriginalInterpolatedTestCompileSourceRoots
protected void setOriginalInterpolatedTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots)
setDynamicScriptSourceRoots
protected void setDynamicScriptSourceRoots(List dynamicScriptSourceRoots)
setOriginalInterpolatedScriptSourceRoots
protected void setOriginalInterpolatedScriptSourceRoots(List originalInterpolatedScriptSourceRoots)
getPreservedProperties
public Properties getPreservedProperties()
preserveProperties
public void preserveProperties()
getPreservedBasedir
public File getPreservedBasedir()
preserveBasedir
public void preserveBasedir()
setLogger
public void setLogger(org.codehaus.plexus.logging.Logger logger)
getProjectBuilderConfiguration
public ProjectBuilderConfiguration getProjectBuilderConfiguration()
- Retrieve the
ProjectBuilderConfiguration
instance used to construct this MavenProject instance.
setProjectBuilderConfiguration
public void setProjectBuilderConfiguration(ProjectBuilderConfiguration projectBuilderConfiguration)
- Set the
ProjectBuilderConfiguration
instance used to construct this MavenProject instance.
- Parameters:
projectBuilderConfiguration
-
Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.