public class MavenProject extends Object implements Cloneable
With changes during 3.2.2 release MavenProject is closer to being immutable after construction with the removal of all components from this class, and the upfront construction taken care of entirely by the @{ProjectBuilder}. There is still the issue of having to run the lifecycle in order to find all the compile source roots and resource directories but I hope to take care of this during the Maven 4.0 release (jvz).
Modifier and Type | Field and Description |
---|---|
static String |
EMPTY_PROJECT_ARTIFACT_ID |
static String |
EMPTY_PROJECT_GROUP_ID |
static String |
EMPTY_PROJECT_VERSION |
Constructor and Description |
---|
MavenProject() |
MavenProject(MavenProject project) |
MavenProject(Model model) |
public static final String EMPTY_PROJECT_GROUP_ID
public static final String EMPTY_PROJECT_ARTIFACT_ID
public static final String EMPTY_PROJECT_VERSION
public MavenProject()
public MavenProject(Model model)
public MavenProject(MavenProject project)
public File getParentFile()
public void setParentFile(File parentFile)
public Artifact getArtifact()
public void setArtifact(Artifact artifact)
public MavenProject getParent()
public void setParent(MavenProject parent)
public boolean hasParent()
public void setPomFile(File file)
file
without changing project basedir
.public File getBasedir()
public void setDependencies(List<Dependency> dependencies)
public List<Dependency> getDependencies()
public DependencyManagement getDependencyManagement()
public void addCompileSourceRoot(String path)
public void addTestCompileSourceRoot(String path)
public List<String> getCompileSourceRoots()
public List<String> getTestCompileSourceRoots()
public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException
public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException
public List<String> getRuntimeClasspathElements() throws DependencyResolutionRequiredException
public void setModelVersion(String pomVersion)
public String getModelVersion()
public void setGroupId(String groupId)
public String getGroupId()
public void setArtifactId(String artifactId)
public String getArtifactId()
public void setVersion(String version)
public String getVersion()
public String getPackaging()
public void setPackaging(String packaging)
public void setInceptionYear(String inceptionYear)
public String getInceptionYear()
public Prerequisites getPrerequisites()
public void setIssueManagement(IssueManagement issueManagement)
public CiManagement getCiManagement()
public void setCiManagement(CiManagement ciManagement)
public IssueManagement getIssueManagement()
public void setDistributionManagement(DistributionManagement distributionManagement)
public DistributionManagement getDistributionManagement()
public void setDescription(String description)
public String getDescription()
public void setOrganization(Organization organization)
public Organization getOrganization()
public void setMailingLists(List<MailingList> mailingLists)
public List<MailingList> getMailingLists()
public void addMailingList(MailingList mailingList)
public void setDevelopers(List<Developer> developers)
public List<Developer> getDevelopers()
public void addDeveloper(Developer developer)
public void setContributors(List<Contributor> contributors)
public List<Contributor> getContributors()
public void addContributor(Contributor contributor)
public List<Resource> getResources()
public List<Resource> getTestResources()
public void addResource(Resource resource)
public void addTestResource(Resource testResource)
public void setLicenses(List<License> licenses)
public List<License> getLicenses()
public void addLicense(License license)
public void setArtifacts(Set<Artifact> artifacts)
public Set<Artifact> getArtifacts()
Set
< Artifact
>to get only direct dependencies
public Map<String,Artifact> getArtifactMap()
public void setPluginArtifacts(Set<Artifact> pluginArtifacts)
public Set<Artifact> getPluginArtifacts()
public Map<String,Artifact> getPluginArtifactMap()
public void setParentArtifact(Artifact parentArtifact)
public Artifact getParentArtifact()
public List<Repository> getRepositories()
public List<Plugin> getBuildPlugins()
public List<String> getModules()
public PluginManagement getPluginManagement()
public void setRemoteArtifactRepositories(List<ArtifactRepository> remoteArtifactRepositories)
public List<ArtifactRepository> getRemoteArtifactRepositories()
public void setPluginArtifactRepositories(List<ArtifactRepository> pluginArtifactRepositories)
public List<ArtifactRepository> getPluginArtifactRepositories()
public ArtifactRepository getDistributionManagementArtifactRepository()
public List<Repository> getPluginRepositories()
public List<org.eclipse.aether.repository.RemoteRepository> getRemoteProjectRepositories()
public List<org.eclipse.aether.repository.RemoteRepository> getRemotePluginRepositories()
public void setActiveProfiles(List<Profile> activeProfiles)
public List<Profile> getActiveProfiles()
public void setInjectedProfileIds(String source, List<String> injectedProfileIds)
public Map<String,List<String>> getInjectedProfileIds()
settings.xml
. The profile identifiers are grouped by the identifier of their source, e.g.
<groupId>:<artifactId>:<version>
for a POM profile or external
for profiles from the
settings.xml
.null
.public void addAttachedArtifact(Artifact artifact) throws DuplicateArtifactAttachmentException
artifact
- the artifact to add or replace.DuplicateArtifactAttachmentException
public List<Artifact> getAttachedArtifacts()
public org.codehaus.plexus.util.xml.Xpp3Dom getGoalConfiguration(String pluginGroupId, String pluginArtifactId, String executionId, String goalId)
public MavenProject getExecutionProject()
public void setExecutionProject(MavenProject executionProject)
public List<MavenProject> getCollectedProjects()
public void setCollectedProjects(List<MavenProject> collectedProjects)
public Set<Artifact> getDependencyArtifacts()
Set
< Artifact
>to get all transitive dependencies
public void setDependencyArtifacts(Set<Artifact> dependencyArtifacts)
public void setReleaseArtifactRepository(ArtifactRepository releaseArtifactRepository)
public void setSnapshotArtifactRepository(ArtifactRepository snapshotArtifactRepository)
public void setOriginalModel(Model originalModel)
public Model getOriginalModel()
public void setManagedVersionMap(Map<String,Artifact> map)
public Map<String,Artifact> getManagedVersionMap()
public List<Extension> getBuildExtensions()
public void addProjectReference(MavenProject project)
public Properties getProperties()
public List<String> getFilters()
public Map<String,MavenProject> getProjectReferences()
public boolean isExecutionRoot()
public void setExecutionRoot(boolean executionRoot)
public String getDefaultGoal()
public MavenProject clone()
clone
in class Object
CloneNotSupportedException
protected void setAttachedArtifacts(List<Artifact> attachedArtifacts)
protected void setCompileSourceRoots(List<String> compileSourceRoots)
protected void setTestCompileSourceRoots(List<String> testCompileSourceRoots)
protected ArtifactRepository getReleaseArtifactRepository()
protected ArtifactRepository getSnapshotArtifactRepository()
public void setContextValue(String key, Object value)
null
, the context value is removed from this project. Context values are intended to allow core
extensions to associate derived state with project instances.public Object getContextValue(String key)
public void setClassRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm)
classRealm
- The class realm hosting the build extensions of this project, may be null
.public org.codehaus.plexus.classworlds.realm.ClassRealm getClassRealm()
null
.public void setExtensionDependencyFilter(org.eclipse.aether.graph.DependencyFilter extensionDependencyFilter)
extensionDependencyFilter
- The dependency filter to apply to plugins, may be null
.public org.eclipse.aether.graph.DependencyFilter getExtensionDependencyFilter()
null
.public void setResolvedArtifacts(Set<Artifact> artifacts)
artifacts
- The set of artifacts, may be null
.public void setArtifactFilter(ArtifactFilter artifactFilter)
artifactFilter
- The artifact filter, may be null
to exclude all artifacts.public boolean hasLifecyclePhase(String phase)
phase
- The phase to check for, must not be null
.true
if the phase has been seen.public void addLifecyclePhase(String lifecyclePhase)
lifecyclePhase
- The lifecycle phase to add, must not be null
.@Deprecated public String getModulePathAdjustment(MavenProject moduleProject) throws IOException
IOException
@Deprecated public Set<Artifact> createArtifacts(ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter filter) throws InvalidDependencyVersionException
@Deprecated protected void setScriptSourceRoots(List<String> scriptSourceRoots)
@Deprecated public void addScriptSourceRoot(String path)
@Deprecated public List<String> getScriptSourceRoots()
@Deprecated public List<Artifact> getCompileArtifacts()
@Deprecated public List<Dependency> getCompileDependencies()
@Deprecated public List<Artifact> getTestArtifacts()
@Deprecated public List<Dependency> getTestDependencies()
@Deprecated public List<Dependency> getRuntimeDependencies()
@Deprecated public List<Artifact> getRuntimeArtifacts()
@Deprecated public List<String> getSystemClasspathElements() throws DependencyResolutionRequiredException
@Deprecated public List<Artifact> getSystemArtifacts()
@Deprecated public List<Dependency> getSystemDependencies()
@Deprecated public void setReporting(Reporting reporting)
@Deprecated public Reporting getReporting()
@Deprecated public void setReportArtifacts(Set<Artifact> reportArtifacts)
@Deprecated public Set<Artifact> getReportArtifacts()
@Deprecated public Map<String,Artifact> getReportArtifactMap()
@Deprecated public void setExtensionArtifacts(Set<Artifact> extensionArtifacts)
@Deprecated public Set<Artifact> getExtensionArtifacts()
@Deprecated public Map<String,Artifact> getExtensionArtifactMap()
@Deprecated public List<ReportPlugin> getReportPlugins()
@Deprecated public org.codehaus.plexus.util.xml.Xpp3Dom getReportConfiguration(String pluginGroupId, String pluginArtifactId, String reportSetId)
@Deprecated public void attachArtifact(String type, String classifier, File file)
@Deprecated public void writeModel(Writer writer) throws IOException
ModelWriter
.IOException
@Deprecated public void writeOriginalModel(Writer writer) throws IOException
ModelWriter
.IOException
@Deprecated public Artifact replaceWithActiveArtifact(Artifact pluginArtifact)
@Deprecated public ProjectBuildingRequest getProjectBuildingRequest()
null
.@Deprecated public void setProjectBuildingRequest(ProjectBuildingRequest projectBuildingRequest)
projectBuildingRequest
- The project building request, may be null
.Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.