Package org.apache.maven.project
Class DefaultMavenProjectBuilder
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.apache.maven.project.DefaultMavenProjectBuilder
-
- All Implemented Interfaces:
MavenProjectBuilder,org.codehaus.plexus.logging.LogEnabled,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable,org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
public class DefaultMavenProjectBuilder extends org.codehaus.plexus.logging.AbstractLogEnabled implements MavenProjectBuilder, org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
- Version:
- $Id$
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.maven.artifact.metadata.ArtifactMetadataSourceartifactMetadataSourceprotected org.apache.maven.artifact.resolver.ArtifactResolverartifactResolverstatic java.lang.StringMAVEN_MODEL_VERSIONprotected org.apache.maven.profiles.MavenProfilesBuilderprofilesBuilder-
Fields inherited from interface org.apache.maven.project.MavenProjectBuilder
ROLE, STANDALONE_SUPERPOM_ARTIFACTID, STANDALONE_SUPERPOM_GROUPID, STANDALONE_SUPERPOM_VERSION
-
-
Constructor Summary
Constructors Constructor Description DefaultMavenProjectBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MavenProjectbuild(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager)MavenProjectbuild(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager, boolean checkDistributionManagementStatus)MavenProjectbuild(java.io.File pom, ProjectBuilderConfiguration config)MavenProjectbuild(java.io.File pom, ProjectBuilderConfiguration config, boolean checkDistributionManagementStatus)MavenProjectbuildFromRepository(org.apache.maven.artifact.Artifact artifact, java.util.List remoteArtifactRepositories, org.apache.maven.artifact.repository.ArtifactRepository localRepository)Build the artifact from the local repository, resolving it if necessary.MavenProjectbuildFromRepository(org.apache.maven.artifact.Artifact artifact, java.util.List remoteArtifactRepositories, org.apache.maven.artifact.repository.ArtifactRepository localRepository, boolean allowStubModel)Build the artifact from the local repository, resolving it if necessary.MavenProjectbuildStandaloneSuperProject(org.apache.maven.artifact.repository.ArtifactRepository localRepository)MavenProjectbuildStandaloneSuperProject(org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager)need to pass a profilemanager with correct context (eg.MavenProjectbuildStandaloneSuperProject(ProjectBuilderConfiguration config)MavenProjectbuildWithDependencies(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager)MavenProjectbuildWithDependencies(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager, org.apache.maven.wagon.events.TransferListener transferListener)voidcalculateConcreteState(MavenProject project, ProjectBuilderConfiguration config)Variant ofMavenProjectBuilder.calculateConcreteState(MavenProject, ProjectBuilderConfiguration, boolean)which assumes that project references should be processed.voidcalculateConcreteState(MavenProject project, ProjectBuilderConfiguration config, boolean processProjectReferences)Up to this point, the build section of the POM remains uninterpolated except for the artifact coordinates it contains.voidcontextualize(org.codehaus.plexus.context.Context context)protected java.util.SetcreateExtensionArtifacts(java.lang.String projectId, java.util.List extensions)protected java.util.SetcreatePluginArtifacts(java.lang.String projectId, java.util.List plugins)protected java.util.SetcreateReportArtifacts(java.lang.String projectId, java.util.List reports)voidinitialize()voidrestoreDynamicState(MavenProject project, ProjectBuilderConfiguration config)voidrestoreDynamicState(MavenProject project, ProjectBuilderConfiguration config, boolean processProjectReferences)
-
-
-
Field Detail
-
profilesBuilder
protected org.apache.maven.profiles.MavenProfilesBuilder profilesBuilder
-
artifactResolver
protected org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver
-
artifactMetadataSource
protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
-
MAVEN_MODEL_VERSION
public static final java.lang.String MAVEN_MODEL_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize()
- Specified by:
initializein interfaceorg.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable
-
build
public MavenProject build(java.io.File pom, ProjectBuilderConfiguration config) throws ProjectBuildingException
- Specified by:
buildin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
build
public MavenProject build(java.io.File pom, ProjectBuilderConfiguration config, boolean checkDistributionManagementStatus) throws ProjectBuildingException
- Specified by:
buildin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
build
public MavenProject build(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager) throws ProjectBuildingException
- Specified by:
buildin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
build
public MavenProject build(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager, boolean checkDistributionManagementStatus) throws ProjectBuildingException
- Specified by:
buildin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
buildFromRepository
public MavenProject buildFromRepository(org.apache.maven.artifact.Artifact artifact, java.util.List remoteArtifactRepositories, org.apache.maven.artifact.repository.ArtifactRepository localRepository, boolean allowStubModel) throws ProjectBuildingException
Description copied from interface:MavenProjectBuilderBuild the artifact from the local repository, resolving it if necessary.- Specified by:
buildFromRepositoryin interfaceMavenProjectBuilder- Parameters:
artifact- the artifact descriptionremoteArtifactRepositories- the remote repository listlocalRepository- the local repositoryallowStubModel- return a stub if the POM is not found- Returns:
- the built project
- Throws:
ProjectBuildingException
-
buildFromRepository
public MavenProject buildFromRepository(org.apache.maven.artifact.Artifact artifact, java.util.List remoteArtifactRepositories, org.apache.maven.artifact.repository.ArtifactRepository localRepository) throws ProjectBuildingException
Description copied from interface:MavenProjectBuilderBuild the artifact from the local repository, resolving it if necessary.- Specified by:
buildFromRepositoryin interfaceMavenProjectBuilder- Parameters:
artifact- the artifact descriptionremoteArtifactRepositories- the remote repository listlocalRepository- the local repository- Returns:
- the built project
- Throws:
ProjectBuildingException
-
buildStandaloneSuperProject
public MavenProject buildStandaloneSuperProject(org.apache.maven.artifact.repository.ArtifactRepository localRepository) throws ProjectBuildingException
- Specified by:
buildStandaloneSuperProjectin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
buildStandaloneSuperProject
public MavenProject buildStandaloneSuperProject(org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager) throws ProjectBuildingException
Description copied from interface:MavenProjectBuilderneed to pass a profilemanager with correct context (eg. with execution properties)- Specified by:
buildStandaloneSuperProjectin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
buildStandaloneSuperProject
public MavenProject buildStandaloneSuperProject(ProjectBuilderConfiguration config) throws ProjectBuildingException
- Specified by:
buildStandaloneSuperProjectin interfaceMavenProjectBuilder- Throws:
ProjectBuildingException
-
buildWithDependencies
public MavenProject buildWithDependencies(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager) throws ProjectBuildingException, org.apache.maven.artifact.resolver.ArtifactResolutionException, org.apache.maven.artifact.resolver.ArtifactNotFoundException
- Specified by:
buildWithDependenciesin interfaceMavenProjectBuilder- Throws:
ProjectBuildingExceptionorg.apache.maven.artifact.resolver.ArtifactResolutionExceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundException
-
buildWithDependencies
public MavenProject buildWithDependencies(java.io.File projectDescriptor, org.apache.maven.artifact.repository.ArtifactRepository localRepository, ProfileManager profileManager, org.apache.maven.wagon.events.TransferListener transferListener) throws ProjectBuildingException, org.apache.maven.artifact.resolver.ArtifactResolutionException, org.apache.maven.artifact.resolver.ArtifactNotFoundException
- Specified by:
buildWithDependenciesin interfaceMavenProjectBuilder- Throws:
ProjectBuildingExceptionorg.apache.maven.artifact.resolver.ArtifactResolutionExceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundException
-
createPluginArtifacts
protected java.util.Set createPluginArtifacts(java.lang.String projectId, java.util.List plugins) throws ProjectBuildingException- Throws:
ProjectBuildingException
-
createReportArtifacts
protected java.util.Set createReportArtifacts(java.lang.String projectId, java.util.List reports) throws ProjectBuildingException- Throws:
ProjectBuildingException
-
createExtensionArtifacts
protected java.util.Set createExtensionArtifacts(java.lang.String projectId, java.util.List extensions) throws ProjectBuildingException- Throws:
ProjectBuildingException
-
contextualize
public void contextualize(org.codehaus.plexus.context.Context context) throws org.codehaus.plexus.context.ContextException- Specified by:
contextualizein interfaceorg.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable- Throws:
org.codehaus.plexus.context.ContextException
-
calculateConcreteState
public void calculateConcreteState(MavenProject project, ProjectBuilderConfiguration config) throws ModelInterpolationException
Variant ofMavenProjectBuilder.calculateConcreteState(MavenProject, ProjectBuilderConfiguration, boolean)which assumes that project references should be processed. This is provided for performance reasons, for cases where you know all projects in the reactor will be processed, making traversal of project references unnecessary.- Specified by:
calculateConcreteStatein interfaceMavenProjectBuilder- Throws:
ModelInterpolationException
-
calculateConcreteState
public void calculateConcreteState(MavenProject project, ProjectBuilderConfiguration config, boolean processProjectReferences) throws ModelInterpolationException
Up to this point, the build section of the POM remains uninterpolated except for the artifact coordinates it contains. This method will interpolate the build section and associated project-instance data structures. Along with theMavenProjectBuilder#restoreDynamicState(MavenProject, ProjectBuilderConfiguration, boolean)method, this method allows expressions in these areas of the POM and project instance to be reevaluated in the event that a mojo changes one the build-path values, or a project property.
This method will process the following:- the specified project's parent project (if not null)
- specified project
- its execution project (if not null)
- any project references (iff processReferences == true)
- Specified by:
calculateConcreteStatein interfaceMavenProjectBuilder- Throws:
ModelInterpolationException
-
restoreDynamicState
public void restoreDynamicState(MavenProject project, ProjectBuilderConfiguration config) throws ModelInterpolationException
- Throws:
ModelInterpolationException
-
restoreDynamicState
public void restoreDynamicState(MavenProject project, ProjectBuilderConfiguration config, boolean processProjectReferences) throws ModelInterpolationException
- Throws:
ModelInterpolationException
-
-