Package 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.
-
-
Field Summary
Fields Modifier and Type Field Description static StringEMPTY_PROJECT_ARTIFACT_IDstatic StringEMPTY_PROJECT_GROUP_IDstatic StringEMPTY_PROJECT_VERSION
-
Constructor Summary
Constructors Constructor Description MavenProject()MavenProject(Model model)MavenProject(Model model, org.codehaus.plexus.logging.Logger logger)MavenProject(MavenProject project)Deprecated.useclone()so subclasses can provide a copy of the same class
-
Method Summary
-
-
-
Field Detail
-
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
-
-
Constructor Detail
-
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.useclone()so subclasses can provide a copy of the same class
-
-
Method Detail
-
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
-
getCompileArtifacts
public List getCompileArtifacts()
-
getCompileDependencies
public List getCompileDependencies()
-
getTestClasspathElements
public List getTestClasspathElements() throws DependencyResolutionRequiredException
-
getTestArtifacts
public List getTestArtifacts()
-
getTestDependencies
public List getTestDependencies()
-
getRuntimeClasspathElements
public List getRuntimeClasspathElements() throws DependencyResolutionRequiredException
-
getRuntimeArtifacts
public List getRuntimeArtifacts()
-
getRuntimeDependencies
public List getRuntimeDependencies()
-
getSystemClasspathElements
public List getSystemClasspathElements() 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()
-
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()
-
clone
public Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- 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 theProjectBuilderConfigurationinstance used to construct this MavenProject instance.
-
setProjectBuilderConfiguration
public void setProjectBuilderConfiguration(ProjectBuilderConfiguration projectBuilderConfiguration)
Set theProjectBuilderConfigurationinstance used to construct this MavenProject instance.- Parameters:
projectBuilderConfiguration-
-
-