public class MavenProject extends Object implements Cloneable
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.
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 Model getModel()
public MavenProject getParent()
public void setParent(MavenProject parent)
public boolean hasParent()
public File getFile()
public void setFile(File file)
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> getCompileClasspathElements() throws DependencyResolutionRequiredException
public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException
public List<String> getRuntimeClasspathElements() throws DependencyResolutionRequiredException
public void setModelVersion(String pomVersion)
public String getModelVersion()
public String getId()
public void setGroupId(String groupId)
public String getGroupId()
public void setArtifactId(String artifactId)
public String getArtifactId()
public void setName(String name)
public String getName()
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 void setUrl(String url)
public String getUrl()
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 setScm(Scm scm)
public Scm getScm()
public void setMailingLists(List<MailingList> mailingLists)
public List<MailingList> getMailingLists()
public void addMailingList(MailingList mailingList)
public void addDeveloper(Developer developer)
public void setContributors(List<Contributor> contributors)
public List<Contributor> getContributors()
public void addContributor(Contributor contributor)
public void setBuild(Build build)
public Build getBuild()
public void addResource(Resource resource)
public void addTestResource(Resource testResource)
public void addLicense(License license)
public Set<Artifact> getArtifacts()
Set
< Artifact
>to get only direct dependencies
public void setParentArtifact(Artifact parentArtifact)
public Artifact getParentArtifact()
public List<Repository> getRepositories()
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 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 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)
@Deprecated public Set<Artifact> getDependencyArtifacts()
Set
< Artifact
>to get all transitive dependencies
@Deprecated 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 addProjectReference(MavenProject project)
public Properties getProperties()
public Map<String,MavenProject> getProjectReferences()
public boolean isExecutionRoot()
public void setExecutionRoot(boolean executionRoot)
public String getDefaultGoal()
public MavenProject clone()
public void setModel(Model model)
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–2018 The Apache Software Foundation. All rights reserved.