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 Listprivate Artifactprivate Mapprivate Setprivate Listprivate Fileprivate Listprivate Listprivate Setprivate Buildprivate Listprivate Listprivate Liststatic final Stringstatic final Stringstatic final Stringprivate MavenProjectprivate booleanprivate Mapprivate Setprivate Fileprivate booleanprivate org.codehaus.plexus.logging.Loggerprivate Mapprivate Modelprivate Mapprivate Buildprivate Listprivate Listprivate Listprivate Modelprivate MavenProjectprivate Artifactprivate Mapprivate Listprivate Setprivate Fileprivate Propertiesprivate ProjectBuilderConfigurationprivate Mapprivate ArtifactRepositoryprivate Listprivate Mapprivate Setprivate Listprivate ArtifactRepositoryprivate List -
Constructor Summary
ConstructorsConstructorDescriptionMavenProject(Model model) MavenProject(Model model, org.codehaus.plexus.logging.Logger logger) MavenProject(MavenProject project) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddArtifactPath(Artifact a, List list) voidaddAttachedArtifact(Artifact artifact) voidaddCompileSourceRoot(String path) voidaddContributor(Contributor contributor) voidaddDeveloper(Developer developer) voidaddLicense(License license) voidaddMailingList(MailingList mailingList) voidvoidaddProjectReference(MavenProject project) voidaddResource(Resource resource) voidaddScriptSourceRoot(String path) voidvoidaddTestResource(Resource testResource) voidattachArtifact(String type, String classifier, File file) Deprecated.Use MavenProjectHelper.attachArtifact(..) instead.voidvoidclone()createArtifacts(ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter dependencyFilter) private final voiddeepCopy(MavenProject project) booleanprivate ArtifactfindMatchingArtifact(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.Xpp3DomgetGoalConfiguration(String pluginGroupId, String pluginArtifactId, String executionId, String goalId) getId()getModel()private BuildgetModulePathAdjustment(MavenProject moduleProject) getName()Retrieve theProjectBuilderConfigurationinstance used to construct this MavenProject instance.static StringgetProjectReferenceId(String groupId, String artifactId, String version) protected ArtifactRepositoryorg.codehaus.plexus.util.xml.Xpp3DomgetReportConfiguration(String pluginGroupId, String pluginArtifactId, String reportSetId) private StringgetRepositoryConflictId(Artifact artifact) Gets the repository conflict id of the specified artifact.getScm()protected ArtifactRepositorygetUrl()inthashCode()booleanvoidinjectPluginManagementInfo(Plugin plugin) booleanbooleanprivate voidlogMissingSiblingProjectArtifact(Artifact artifact) voidvoidpreserveBuild(Build originalInterpolatedBuild) voidpreserveCompileSourceRoots(List originalInterpolatedCompileSourceRoots) voidvoidpreserveScriptSourceRoots(List originalInterpolatedScriptSourceRoots) voidpreserveTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots) replaceWithActiveArtifact(Artifact pluginArtifact) voidvoidsetActiveProfiles(List activeProfiles) voidsetArtifact(Artifact artifact) voidsetArtifactId(String artifactId) voidsetArtifacts(Set artifacts) protected voidsetAttachedArtifacts(List attachedArtifacts) voidsetBasedir(File basedir) voidvoidsetCiManagement(CiManagement ciManagement) voidsetCollectedProjects(List collectedProjects) protected voidsetCompileSourceRoots(List compileSourceRoots) voidsetConcrete(boolean concrete) voidsetContributors(List contributors) voidsetDependencies(List dependencies) voidsetDependencyArtifacts(Set dependencyArtifacts) voidsetDescription(String description) voidsetDevelopers(List developers) voidsetDistributionManagement(DistributionManagement distributionManagement) protected voidsetDynamicBuild(Build dynamicBuild) protected voidsetDynamicCompileSourceRoots(List dynamicCompileSourceRoots) protected voidsetDynamicScriptSourceRoots(List dynamicScriptSourceRoots) protected voidsetDynamicTestCompileSourceRoots(List dynamicTestCompileSourceRoots) voidsetExecutionProject(MavenProject executionProject) voidsetExecutionRoot(boolean executionRoot) voidsetExtensionArtifacts(Set extensionArtifacts) voidvoidsetGroupId(String groupId) voidsetInceptionYear(String inceptionYear) voidsetIssueManagement(IssueManagement issueManagement) voidsetLicenses(List licenses) voidsetLogger(org.codehaus.plexus.logging.Logger logger) voidsetMailingLists(List mailingLists) voidsetManagedVersionMap(Map map) protected voidvoidsetModelVersion(String pomVersion) voidvoidsetOrganization(Organization organization) protected voidsetOriginalInterpolatedBuild(Build originalInterpolatedBuild) protected voidsetOriginalInterpolatedCompileSourceRoots(List originalInterpolatedCompileSourceRoots) protected voidsetOriginalInterpolatedScriptSourceRoots(List originalInterpolatedScriptSourceRoots) protected voidsetOriginalInterpolatedTestCompileSourceRoots(List originalInterpolatedTestCompileSourceRoots) voidsetOriginalModel(Model originalModel) voidsetPackaging(String packaging) voidsetParent(MavenProject parent) voidsetParentArtifact(Artifact parentArtifact) voidsetPluginArtifactRepositories(List pluginArtifactRepositories) voidsetPluginArtifacts(Set pluginArtifacts) voidsetProjectBuilderConfiguration(ProjectBuilderConfiguration projectBuilderConfiguration) Set theProjectBuilderConfigurationinstance used to construct this MavenProject instance.voidsetReleaseArtifactRepository(ArtifactRepository releaseArtifactRepository) voidsetRemoteArtifactRepositories(List remoteArtifactRepositories) voidsetReportArtifacts(Set reportArtifacts) voidsetReporting(Reporting reporting) voidprotected voidsetScriptSourceRoots(List scriptSourceRoots) voidsetSnapshotArtifactRepository(ArtifactRepository snapshotArtifactRepository) protected voidsetTestCompileSourceRoots(List testCompileSourceRoots) voidvoidsetVersion(String version) toString()Default toStringvoidwriteModel(Writer writer) voidwriteOriginalModel(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
nullif 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:
clonein 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 theProjectBuilderConfigurationinstance used to construct this MavenProject instance. -
setProjectBuilderConfiguration
Set theProjectBuilderConfigurationinstance used to construct this MavenProject instance.- Parameters:
projectBuilderConfiguration-
-
clone()so subclasses can provide a copy of the same class