Package org.apache.maven.project
Class DefaultProjectBuilder
java.lang.Object
org.apache.maven.project.DefaultProjectBuilder
- All Implemented Interfaces:
ProjectBuilder
@Component(role=ProjectBuilder.class)
public class DefaultProjectBuilder
extends Object
implements ProjectBuilder
DefaultProjectBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) classInternalConfig -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ProjectDependenciesResolverstatic final Stringprivate org.codehaus.plexus.logging.Loggerprivate ModelBuilderprivate ModelCacheFactoryprivate ModelProcessorprivate ProjectBuildingHelperprivate org.eclipse.aether.impl.RemoteRepositoryManagerprivate MavenRepositorySystemprivate org.eclipse.aether.RepositorySystem -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ProjectBuildingResultbuild(File pomFile, ModelSource modelSource, DefaultProjectBuilder.InternalConfig config) build(File pomFile, ProjectBuildingRequest request) Builds a project descriptor from the specified POM file.build(List<File> pomFiles, boolean recursive, ProjectBuildingRequest request) Builds the projects for the specified POM files and optionally their children.private booleanbuild(List<ProjectBuildingResult> results, List<DefaultProjectBuilder.InterimResult> interimResults, Map<String, MavenProject> projectIndex, File pomFile, Set<File> aggregatorFiles, boolean isRoot, boolean recursive, DefaultProjectBuilder.InternalConfig config) private booleanbuild(List<ProjectBuildingResult> results, List<DefaultProjectBuilder.InterimResult> interimResults, Map<String, MavenProject> projectIndex, List<File> pomFiles, Set<File> aggregatorFiles, boolean isRoot, boolean recursive, DefaultProjectBuilder.InternalConfig config) private booleanbuild(List<ProjectBuildingResult> results, List<MavenProject> projects, Map<String, MavenProject> projectIndex, List<DefaultProjectBuilder.InterimResult> interimResults, ProjectBuildingRequest request, Map<File, Boolean> profilesXmls, org.eclipse.aether.RepositorySystemSession session) build(Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request) Builds a project descriptor for the specified artifact.build(Artifact artifact, ProjectBuildingRequest request) Builds a project descriptor for the specified artifact.build(ModelSource modelSource, ProjectBuildingRequest request) Builds a project descriptor for the specified model source.private ModelCachecreateModelCache(org.eclipse.aether.RepositorySystemSession session) private ModelSourcecreateStubModelSource(Artifact artifact) private StringfindProfilesXml(ModelBuildingResult result, Map<File, Boolean> profilesXmls) private ModelBuildingRequestgetProfileIds(List<Profile> profiles) private static StringinheritedGroupId(ModelBuildingResult result, int modelIndex) private static StringinheritedVersion(ModelBuildingResult result, int modelIndex) private voidinitParent(MavenProject project, Map<String, MavenProject> projects, boolean buildParentIfNotExisting, ModelBuildingResult result, ProjectBuildingRequest projectBuildingRequest) private voidinitProject(MavenProject project, Map<String, MavenProject> projects, boolean buildParentIfNotExisting, ModelBuildingResult result, Map<File, Boolean> profilesXmls, ProjectBuildingRequest projectBuildingRequest) private voidpopulateReactorModelPool(ReactorModelPool reactorModelPool, List<DefaultProjectBuilder.InterimResult> interimResults) private DependencyResolutionResultresolveDependencies(MavenProject project, org.eclipse.aether.RepositorySystemSession session) private boolean
-
Field Details
-
DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY
- See Also:
-
logger
@Requirement private org.codehaus.plexus.logging.Logger logger -
modelBuilder
-
modelProcessor
-
projectBuildingHelper
-
repositorySystem
-
repoSystem
@Requirement private org.eclipse.aether.RepositorySystem repoSystem -
repositoryManager
@Requirement private org.eclipse.aether.impl.RemoteRepositoryManager repositoryManager -
dependencyResolver
-
modelCacheFactory
-
-
Constructor Details
-
DefaultProjectBuilder
public DefaultProjectBuilder()
-
-
Method Details
-
build
public ProjectBuildingResult build(File pomFile, ProjectBuildingRequest request) throws ProjectBuildingException Description copied from interface:ProjectBuilderBuilds a project descriptor from the specified POM file.- Specified by:
buildin interfaceProjectBuilder- Parameters:
pomFile- The POM file to build the project from, must not benull.request- The project building request that holds further parameters, must not benull.- Returns:
- The result of the project building, never
null. - Throws:
ProjectBuildingException- If the project descriptor could not be successfully built.
-
useGlobalModelCache
private boolean useGlobalModelCache() -
build
public ProjectBuildingResult build(ModelSource modelSource, ProjectBuildingRequest request) throws ProjectBuildingException Description copied from interface:ProjectBuilderBuilds a project descriptor for the specified model source.- Specified by:
buildin interfaceProjectBuilder- Parameters:
modelSource- The source of the model to built the project descriptor from, must not benull.request- The project building request that holds further parameters, must not benull.- Returns:
- The result of the project building, never
null. - Throws:
ProjectBuildingException- If the project descriptor could not be successfully built.- See Also:
-
build
private ProjectBuildingResult build(File pomFile, ModelSource modelSource, DefaultProjectBuilder.InternalConfig config) throws ProjectBuildingException - Throws:
ProjectBuildingException
-
resolveDependencies
private DependencyResolutionResult resolveDependencies(MavenProject project, org.eclipse.aether.RepositorySystemSession session) -
getProfileIds
-
getModelBuildingRequest
-
build
public ProjectBuildingResult build(Artifact artifact, ProjectBuildingRequest request) throws ProjectBuildingException Description copied from interface:ProjectBuilderBuilds a project descriptor for the specified artifact.- Specified by:
buildin interfaceProjectBuilder- Parameters:
artifact- The POM artifact to build the project from, must not benull.request- The project building request that holds further parameters, must not benull.- Returns:
- The result of the project building, never
null. - Throws:
ProjectBuildingException- If the project descriptor could not be successfully built.
-
build
public ProjectBuildingResult build(Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request) throws ProjectBuildingException Description copied from interface:ProjectBuilderBuilds a project descriptor for the specified artifact.- Specified by:
buildin interfaceProjectBuilder- Parameters:
artifact- The POM artifact to build the project from, must not benull.allowStubModel- A flag controlling the case of a missing POM artifact. Iftrueand the specified POM artifact does not exist, a simple stub model will be returned. Iffalse, an exception will be thrown.request- The project building request that holds further parameters, must not benull.- Returns:
- The result of the project building, never
null. - Throws:
ProjectBuildingException- If the project descriptor could not be successfully built.
-
createStubModelSource
-
build
public List<ProjectBuildingResult> build(List<File> pomFiles, boolean recursive, ProjectBuildingRequest request) throws ProjectBuildingException Description copied from interface:ProjectBuilderBuilds the projects for the specified POM files and optionally their children.- Specified by:
buildin interfaceProjectBuilder- Parameters:
pomFiles- The POM files to build, must not benull.recursive-trueto recursively build sub modules referenced by the POM files,falseto build only the specified POM files.request- The project builder configuration that provides further parameters, must not benull.- Returns:
- The results of the project builder where each result corresponds to one project that was built, never
null. - Throws:
ProjectBuildingException- If an error was encountered during building of any project.ProjectBuildingException.getResults()provides access to the details of the problems.
-
build
private boolean build(List<ProjectBuildingResult> results, List<DefaultProjectBuilder.InterimResult> interimResults, Map<String, MavenProject> projectIndex, List<File> pomFiles, Set<File> aggregatorFiles, boolean isRoot, boolean recursive, DefaultProjectBuilder.InternalConfig config) -
build
private boolean build(List<ProjectBuildingResult> results, List<DefaultProjectBuilder.InterimResult> interimResults, Map<String, MavenProject> projectIndex, File pomFile, Set<File> aggregatorFiles, boolean isRoot, boolean recursive, DefaultProjectBuilder.InternalConfig config) -
populateReactorModelPool
private void populateReactorModelPool(ReactorModelPool reactorModelPool, List<DefaultProjectBuilder.InterimResult> interimResults) -
build
private boolean build(List<ProjectBuildingResult> results, List<MavenProject> projects, Map<String, MavenProject> projectIndex, List<DefaultProjectBuilder.InterimResult> interimResults, ProjectBuildingRequest request, Map<File, Boolean> profilesXmls, org.eclipse.aether.RepositorySystemSession session) -
initProject
private void initProject(MavenProject project, Map<String, MavenProject> projects, boolean buildParentIfNotExisting, ModelBuildingResult result, Map<File, Boolean> profilesXmls, ProjectBuildingRequest projectBuildingRequest) -
initParent
private void initParent(MavenProject project, Map<String, MavenProject> projects, boolean buildParentIfNotExisting, ModelBuildingResult result, ProjectBuildingRequest projectBuildingRequest) -
inheritedGroupId
-
inheritedVersion
-
findProfilesXml
-
createModelCache
-