Class MultiModuleCollectionStrategy
java.lang.Object
org.apache.maven.project.collector.MultiModuleCollectionStrategy
- All Implemented Interfaces:
ProjectCollectionStrategy
@Named("MultiModuleCollectionStrategy")
@Singleton
public class MultiModuleCollectionStrategy
extends Object
implements ProjectCollectionStrategy
Strategy for collecting Maven projects from the multi-module project root, even when executed in a submodule.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final ModelLocatorprivate final ProjectsSelector -
Constructor Summary
ConstructorsConstructorDescriptionMultiModuleCollectionStrategy(ModelLocator modelLocator, ProjectsSelector projectsSelector) -
Method Summary
Modifier and TypeMethodDescriptioncollectProjects(MavenExecutionRequest request) private FilegetRootProject(MavenExecutionRequest request) private booleanisModuleOutsideRequestScopeDependingOnPluginModule(MavenExecutionRequest request, ProjectBuildingException exception) This method finds out whether collecting projects failed because of the following scenario: - A multi-module project containing a module which is a plugin and another module which depends on it.private booleanisRequestedProjectCollected(MavenExecutionRequest request, List<MavenProject> projects) multiModuleProjectDirectory in MavenExecutionRequest is not always the parent of the request pom.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
modelLocator
-
projectsSelector
-
-
Constructor Details
-
MultiModuleCollectionStrategy
@Inject public MultiModuleCollectionStrategy(ModelLocator modelLocator, ProjectsSelector projectsSelector)
-
-
Method Details
-
collectProjects
public List<MavenProject> collectProjects(MavenExecutionRequest request) throws ProjectBuildingException - Specified by:
collectProjectsin interfaceProjectCollectionStrategy- Parameters:
request-- Returns:
- Throws:
ProjectBuildingException
-
getRootProject
-
isRequestedProjectCollected
private boolean isRequestedProjectCollected(MavenExecutionRequest request, List<MavenProject> projects) multiModuleProjectDirectory in MavenExecutionRequest is not always the parent of the request pom. We should always check whether the request pom project is collected. The integration tests for MNG-6223 are examples for this scenario.- Returns:
- true if the collected projects contain the requested project (for example with -f)
-
isModuleOutsideRequestScopeDependingOnPluginModule
private boolean isModuleOutsideRequestScopeDependingOnPluginModule(MavenExecutionRequest request, ProjectBuildingException exception) This method finds out whether collecting projects failed because of the following scenario: - A multi-module project containing a module which is a plugin and another module which depends on it. - Just the plugin is being built with the -fflag. - Because of inter-module dependency collection, all projects in the multi-module project are collected. - The plugin is not yet installed in a repository. Therefore the build fails because the plugin is not found and plugins cannot be built in the same session. The integration test for MNG-5572 is an example of this scenario. - Returns:
- true if the module which fails to collect the inter-module plugin is not part of the build.
-