Package org.apache.maven.project
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
FieldsModifier and TypeFieldDescriptionprivate List
private Artifact
private Map
private Set
private List
private File
private List
private List
private Set
private Build
private List
private List
private List
static final String
static final String
static final String
private MavenProject
private boolean
private Map
private Set
private File
private boolean
private org.codehaus.plexus.logging.Logger
private Map
private Model
private Map
private Build
private List
private List
private List
private Model
private MavenProject
private Artifact
private Map
private List
private Set
private File
private Properties
private ProjectBuilderConfiguration
private Map
private ArtifactRepository
private List
private Map
private Set
private List
private ArtifactRepository
private List
-
Constructor Summary
ConstructorsConstructorDescriptionMavenProject
(Model model) MavenProject
(Model model, org.codehaus.plexus.logging.Logger logger) MavenProject
(MavenProject project) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addArtifactPath
(Artifact a, List list) 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
void
addProjectReference
(MavenProject project) void
addResource
(Resource resource) void
addScriptSourceRoot
(String path) void
void
addTestResource
(Resource testResource) void
attachArtifact
(String type, String classifier, File file) Deprecated.Use MavenProjectHelper.attachArtifact(..) instead.void
void
clone()
createArtifacts
(ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter dependencyFilter) private final void
deepCopy
(MavenProject project) boolean
private Artifact
findMatchingArtifact
(List artifacts, Artifact requestedArtifact) Tries to resolve the specified artifact from the given collection of attached project artifacts.All dependencies that this project has, including transitive ones.getBuild()
Direct dependencies that this project has.getFile()
org.codehaus.plexus.util.xml.Xpp3Dom
getGoalConfiguration
(String pluginGroupId, String pluginArtifactId, String executionId, String goalId) getId()
getModel()
private Build
getModulePathAdjustment
(MavenProject moduleProject) getName()
Retrieve theProjectBuilderConfiguration
instance used to construct this MavenProject instance.static String
getProjectReferenceId
(String groupId, String artifactId, String version) protected ArtifactRepository
org.codehaus.plexus.util.xml.Xpp3Dom
getReportConfiguration
(String pluginGroupId, String pluginArtifactId, String reportSetId) private String
getRepositoryConflictId
(Artifact artifact) Gets the repository conflict id of the specified artifact.getScm()
protected ArtifactRepository
getUrl()
int
hashCode()
boolean
void
injectPluginManagementInfo
(Plugin plugin) boolean
boolean
private void
logMissingSiblingProjectArtifact
(Artifact artifact) void
void
preserveBuild
(Build originalInterpolatedBuild) void
preserveCompileSourceRoots
(List originalInterpolatedCompileSourceRoots) void
void
preserveScriptSourceRoots
(List originalInterpolatedScriptSourceRoots) void
preserveTestCompileSourceRoots
(List originalInterpolatedTestCompileSourceRoots) replaceWithActiveArtifact
(Artifact pluginArtifact) void
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
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
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
void
setModelVersion
(String pomVersion) void
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 theProjectBuilderConfiguration
instance used to construct this MavenProject instance.void
setReleaseArtifactRepository
(ArtifactRepository releaseArtifactRepository) void
setRemoteArtifactRepositories
(List remoteArtifactRepositories) void
setReportArtifacts
(Set reportArtifacts) void
setReporting
(Reporting reporting) void
protected void
setScriptSourceRoots
(List scriptSourceRoots) void
setSnapshotArtifactRepository
(ArtifactRepository snapshotArtifactRepository) protected void
setTestCompileSourceRoots
(List testCompileSourceRoots) void
void
setVersion
(String version) toString()
Default toStringvoid
writeModel
(Writer writer) void
writeOriginalModel
(Writer writer)
-
Field Details
-
EMPTY_PROJECT_GROUP_ID
- See Also:
-
EMPTY_PROJECT_ARTIFACT_ID
- See Also:
-
EMPTY_PROJECT_VERSION
- See Also:
-
model
-
parent
-
file
-
artifacts
-
parentArtifact
-
pluginArtifacts
-
remoteArtifactRepositories
-
collectedProjects
-
attachedArtifacts
-
executionProject
-
compileSourceRoots
-
testCompileSourceRoots
-
scriptSourceRoots
-
pluginArtifactRepositories
-
releaseArtifactRepository
-
snapshotArtifactRepository
-
activeProfiles
-
dependencyArtifacts
-
artifact
-
artifactMap
-
originalModel
-
pluginArtifactMap
-
reportArtifacts
-
reportArtifactMap
-
extensionArtifacts
-
extensionArtifactMap
-
managedVersionMap
-
projectReferences
-
executionRoot
private boolean executionRoot -
moduleAdjustments
-
basedir
-
logger
private org.codehaus.plexus.logging.Logger logger -
projectBuilderConfiguration
-
dynamicBuild
-
originalInterpolatedBuild
-
dynamicCompileSourceRoots
-
originalInterpolatedCompileSourceRoots
-
dynamicTestCompileSourceRoots
-
originalInterpolatedTestCompileSourceRoots
-
dynamicScriptSourceRoots
-
originalInterpolatedScriptSourceRoots
-
isConcrete
private boolean isConcrete -
preservedProperties
-
preservedBasedir
-
-
Constructor Details
-
MavenProject
public MavenProject() -
MavenProject
-
MavenProject
-
MavenProject
Deprecated.useclone()
so subclasses can provide a copy of the same class
-
-
Method Details
-
deepCopy
-
getModulePathAdjustment
- Throws:
IOException
-
getArtifact
-
setArtifact
-
getModel
-
getParent
-
setParent
-
setRemoteArtifactRepositories
-
getRemoteArtifactRepositories
-
hasParent
public boolean hasParent() -
getFile
-
setFile
-
setBasedir
-
getBasedir
-
setDependencies
-
getDependencies
-
getDependencyManagement
-
addCompileSourceRoot
-
addScriptSourceRoot
-
addTestCompileSourceRoot
-
getCompileSourceRoots
-
getScriptSourceRoots
-
getTestCompileSourceRoots
-
getCompileClasspathElements
-
getCompileArtifacts
-
getCompileDependencies
-
getTestClasspathElements
-
getTestArtifacts
-
getTestDependencies
-
getRuntimeClasspathElements
-
getRuntimeArtifacts
-
getRuntimeDependencies
-
getSystemClasspathElements
-
getSystemArtifacts
-
getSystemDependencies
-
setModelVersion
-
getModelVersion
-
getId
-
setGroupId
-
getGroupId
-
setArtifactId
-
getArtifactId
-
setName
-
getName
-
setVersion
-
getVersion
-
getPackaging
-
setPackaging
-
setInceptionYear
-
getInceptionYear
-
setUrl
-
getUrl
-
getPrerequisites
-
setIssueManagement
-
getCiManagement
-
setCiManagement
-
getIssueManagement
-
setDistributionManagement
-
getDistributionManagement
-
setDescription
-
getDescription
-
setOrganization
-
getOrganization
-
setScm
-
getScm
-
setMailingLists
-
getMailingLists
-
addMailingList
-
setDevelopers
-
getDevelopers
-
addDeveloper
-
setContributors
-
getContributors
-
addContributor
-
setBuild
-
getBuild
-
getResources
-
getTestResources
-
addResource
-
addTestResource
-
setReporting
-
getReporting
-
setLicenses
-
getLicenses
-
addLicense
-
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. -
getArtifactMap
-
setPluginArtifacts
-
getPluginArtifacts
-
getPluginArtifactMap
-
setReportArtifacts
-
getReportArtifacts
-
getReportArtifactMap
-
setExtensionArtifacts
-
getExtensionArtifacts
-
getExtensionArtifactMap
-
setParentArtifact
-
getParentArtifact
-
getRepositories
-
getReportPlugins
-
getBuildPlugins
-
getModules
-
getPluginManagement
-
getModelBuild
-
addPlugin
-
injectPluginManagementInfo
-
getCollectedProjects
-
setCollectedProjects
-
setPluginArtifactRepositories
-
getPluginArtifactRepositories
- Returns:
- a list of ArtifactRepository objects constructed from the Repository objects returned by getPluginRepositories.
-
getDistributionManagementArtifactRepository
-
getPluginRepositories
-
setActiveProfiles
-
getActiveProfiles
-
addAttachedArtifact
-
getAttachedArtifacts
-
getGoalConfiguration
-
getReportConfiguration
-
getExecutionProject
-
setExecutionProject
-
writeModel
- Throws:
IOException
-
writeOriginalModel
- Throws:
IOException
-
getDependencyArtifacts
Direct dependencies that this project has. -
setDependencyArtifacts
-
setReleaseArtifactRepository
-
setSnapshotArtifactRepository
-
setOriginalModel
-
getOriginalModel
-
setManagedVersionMap
-
getManagedVersionMap
-
equals
-
hashCode
public int hashCode() -
getBuildExtensions
-
createArtifacts
public Set createArtifacts(ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter dependencyFilter) throws InvalidDependencyVersionException - Returns:
Set
<Artifact
>- Throws:
InvalidDependencyVersionException
-
addProjectReference
-
getProjectReferenceId
-
attachArtifact
Deprecated.Use MavenProjectHelper.attachArtifact(..) instead. -
getProperties
-
getFilters
-
getProjectReferences
-
isExecutionRoot
public boolean isExecutionRoot() -
setExecutionRoot
public void setExecutionRoot(boolean executionRoot) -
getDefaultGoal
-
setModel
-
setAttachedArtifacts
-
setCompileSourceRoots
-
setTestCompileSourceRoots
-
setScriptSourceRoots
-
getReleaseArtifactRepository
-
getSnapshotArtifactRepository
-
resolveActiveArtifacts
public void resolveActiveArtifacts() -
replaceWithActiveArtifact
-
findMatchingArtifact
Tries to resolve the specified artifact from the given collection of attached project artifacts.- Parameters:
artifacts
- The attached artifacts, may benull
.requestedArtifact
- The artifact to resolve, must not benull
.- Returns:
- The matching artifact or
null
if not found.
-
getRepositoryConflictId
Gets the repository conflict id of the specified artifact. Unlike the dependency conflict id, the repository conflict id uses the artifact file extension instead of the artifact type. Hence, the repository conflict id more closely reflects the identity of artifacts as perceived by a repository.- Parameters:
artifact
- The artifact, must not benull
.- Returns:
- The repository conflict id, never
null
.
-
logMissingSiblingProjectArtifact
-
addArtifactPath
-
toString
Default toString -
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
- Since:
- 2.0.9
-
isConcrete
public boolean isConcrete() -
setConcrete
public void setConcrete(boolean concrete) -
getDynamicBuild
-
getOriginalInterpolatedBuild
-
getDynamicCompileSourceRoots
-
getOriginalInterpolatedCompileSourceRoots
-
getDynamicTestCompileSourceRoots
-
getOriginalInterpolatedTestCompileSourceRoots
-
getDynamicScriptSourceRoots
-
getOriginalInterpolatedScriptSourceRoots
-
clearRestorableRoots
public void clearRestorableRoots() -
clearRestorableBuild
public void clearRestorableBuild() -
preserveCompileSourceRoots
-
preserveTestCompileSourceRoots
-
preserveScriptSourceRoots
-
preserveBuild
-
setDynamicBuild
-
setOriginalInterpolatedBuild
-
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 theProjectBuilderConfiguration
instance used to construct this MavenProject instance. -
setProjectBuilderConfiguration
Set theProjectBuilderConfiguration
instance used to construct this MavenProject instance.- Parameters:
projectBuilderConfiguration
-
-
clone()
so subclasses can provide a copy of the same class