org.apache.maven.project

## Class DefaultMavenProjectBuilder

- java.lang.Object
- - AbstractLogEnabled
  - - org.apache.maven.project.DefaultMavenProjectBuilder

All Implemented Interfaces:
  MavenProjectBuilder

    public class DefaultMavenProjectBuilder
    extends AbstractLogEnabled
    implements MavenProjectBuilder

Version:
  $Id: DefaultMavenProjectBuilder.java 788791 2009-06-26 17:55:26Z jdcasey $

### Field Summary

Fields
`protected ArtifactMetadataSource` `artifactMetadataSource`
`protected ArtifactResolver` `artifactResolver`
`static java.lang.String` `MAVEN_MODEL_VERSION`
`protected MavenProfilesBuilder` `profilesBuilder`

### Fields inherited from interface org.apache.maven.project.MavenProjectBuilder

`ROLE, STANDALONE_SUPERPOM_ARTIFACTID, STANDALONE_SUPERPOM_GROUPID, STANDALONE_SUPERPOM_VERSION`

### Constructor Summary

Constructors
Constructor and Description
`DefaultMavenProjectBuilder()`

### Method Summary

Methods
`MavenProject` `build(java.io.File projectDescriptor, ArtifactRepository localRepository, ProfileManager profileManager)`
`MavenProject` `build(java.io.File projectDescriptor, ArtifactRepository localRepository, ProfileManager profileManager, boolean checkDistributionManagementStatus)`
`MavenProject` `build(java.io.File pom, ProjectBuilderConfiguration config)`
`MavenProject` `build(java.io.File pom, ProjectBuilderConfiguration config, boolean checkDistributionManagementStatus)`
`MavenProject` `buildFromRepository(Artifact artifact, java.util.List remoteArtifactRepositories, ArtifactRepository localRepository)` Build the artifact from the local repository, resolving it if necessary.
`MavenProject` `buildFromRepository(Artifact artifact, java.util.List remoteArtifactRepositories, ArtifactRepository localRepository, boolean allowStubModel)` Build the artifact from the local repository, resolving it if necessary.
`MavenProject` `buildStandaloneSuperProject(ArtifactRepository localRepository)`
`MavenProject` `buildStandaloneSuperProject(ArtifactRepository localRepository, ProfileManager profileManager)` need to pass a profilemanager with correct context (eg.
`MavenProject` `buildStandaloneSuperProject(ProjectBuilderConfiguration config)`
`MavenProject` `buildWithDependencies(java.io.File projectDescriptor, ArtifactRepository localRepository, ProfileManager profileManager)`
`MavenProject` `buildWithDependencies(java.io.File projectDescriptor, ArtifactRepository localRepository, ProfileManager profileManager, TransferListener transferListener)`
`void` `calculateConcreteState(MavenProject project, ProjectBuilderConfiguration config)` Variant of `MavenProjectBuilder.calculateConcreteState(MavenProject, ProjectBuilderConfiguration, boolean)` which assumes that project references should be processed.
`void` `calculateConcreteState(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.
`void` `contextualize(Context context)`
`protected java.util.Set` `createExtensionArtifacts(java.lang.String projectId, java.util.List extensions)`
`protected java.util.Set` `createPluginArtifacts(java.lang.String projectId, java.util.List plugins)`
`protected java.util.Set` `createReportArtifacts(java.lang.String projectId, java.util.List reports)`
`void` `initialize()`
`void` `restoreDynamicState(MavenProject project, ProjectBuilderConfiguration config)`
`void` `restoreDynamicState(MavenProject project, ProjectBuilderConfiguration config, boolean processProjectReferences)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### profilesBuilder

    protected MavenProfilesBuilder profilesBuilder

#### artifactResolver

    protected ArtifactResolver artifactResolver

#### artifactMetadataSource

    protected ArtifactMetadataSource artifactMetadataSource

#### MAVEN_MODEL_VERSION

    public static final java.lang.String MAVEN_MODEL_VERSION

See Also:
  Constant Field Values

### Constructor Detail

#### DefaultMavenProjectBuilder

    public DefaultMavenProjectBuilder()

### Method Detail

#### initialize

    public void initialize()

#### build

    public MavenProject build(java.io.File pom,
                     ProjectBuilderConfiguration config)
                       throws ProjectBuildingException

Specified by:
  `build` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### build

    public MavenProject build(java.io.File pom,
                     ProjectBuilderConfiguration config,
                     boolean checkDistributionManagementStatus)
                       throws ProjectBuildingException

Specified by:
  `build` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### build

    public MavenProject build(java.io.File projectDescriptor,
                     ArtifactRepository localRepository,
                     ProfileManager profileManager)
                       throws ProjectBuildingException

Specified by:
  `build` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### build

    public MavenProject build(java.io.File projectDescriptor,
                     ArtifactRepository localRepository,
                     ProfileManager profileManager,
                     boolean checkDistributionManagementStatus)
                       throws ProjectBuildingException

Specified by:
  `build` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### buildFromRepository

    public MavenProject buildFromRepository(Artifact artifact,
                                   java.util.List remoteArtifactRepositories,
                                   ArtifactRepository localRepository,
                                   boolean allowStubModel)
                                     throws ProjectBuildingException

Description copied from interface: `MavenProjectBuilder`
Build the artifact from the local repository, resolving it if necessary.

Specified by:
  `buildFromRepository` in interface `MavenProjectBuilder`
Parameters:
  `artifact` - the artifact description
  `remoteArtifactRepositories` - the remote repository list
  `localRepository` - the local repository
  `allowStubModel` - return a stub if the POM is not found
Returns:
  the built project
Throws:
  `ProjectBuildingException`

#### buildFromRepository

    public MavenProject buildFromRepository(Artifact artifact,
                                   java.util.List remoteArtifactRepositories,
                                   ArtifactRepository localRepository)
                                     throws ProjectBuildingException

Description copied from interface: `MavenProjectBuilder`
Build the artifact from the local repository, resolving it if necessary.

Specified by:
  `buildFromRepository` in interface `MavenProjectBuilder`
Parameters:
  `artifact` - the artifact description
  `remoteArtifactRepositories` - the remote repository list
  `localRepository` - the local repository
Returns:
  the built project
Throws:
  `ProjectBuildingException`

#### buildStandaloneSuperProject

    public MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository)
                                             throws ProjectBuildingException

Specified by:
  `buildStandaloneSuperProject` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### buildStandaloneSuperProject

    public MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository,
                                           ProfileManager profileManager)
                                             throws ProjectBuildingException

Description copied from interface: `MavenProjectBuilder`
need to pass a profilemanager with correct context (eg. with execution properties)

Specified by:
  `buildStandaloneSuperProject` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### buildStandaloneSuperProject

    public MavenProject buildStandaloneSuperProject(ProjectBuilderConfiguration config)
                                             throws ProjectBuildingException

Specified by:
  `buildStandaloneSuperProject` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`

#### buildWithDependencies

    public MavenProject buildWithDependencies(java.io.File projectDescriptor,
                                     ArtifactRepository localRepository,
                                     ProfileManager profileManager)
                                       throws ProjectBuildingException,
                                              ArtifactResolutionException,
                                              ArtifactNotFoundException

Specified by:
  `buildWithDependencies` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`
  `ArtifactResolutionException`
  `ArtifactNotFoundException`

#### buildWithDependencies

    public MavenProject buildWithDependencies(java.io.File projectDescriptor,
                                     ArtifactRepository localRepository,
                                     ProfileManager profileManager,
                                     TransferListener transferListener)
                                       throws ProjectBuildingException,
                                              ArtifactResolutionException,
                                              ArtifactNotFoundException

Specified by:
  `buildWithDependencies` in interface `MavenProjectBuilder`
Throws:
  `ProjectBuildingException`
  `ArtifactResolutionException`
  `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(Context context)
                       throws ContextException

Throws:
  `ContextException`

#### calculateConcreteState

    public void calculateConcreteState(MavenProject project,
                              ProjectBuilderConfiguration config)
                                throws ModelInterpolationException

Variant of `MavenProjectBuilder.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:
  `calculateConcreteState` in interface `MavenProjectBuilder`
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 the `MavenProjectBuilder#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:

1. the specified project's parent project (if not null)
2. specified project
3. its execution project (if not null)
4. any project references (iff processReferences == true)

Specified by:
  `calculateConcreteState` in interface `MavenProjectBuilder`
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`