diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index 1e01a5a38f..53aea6ba6b 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -231,10 +231,12 @@ public class DefaultModelBuilder public ModelBuildingResult build( ModelBuildingRequest request ) throws ModelBuildingException { + // phase 1 DefaultModelBuildingResult result = new DefaultModelBuildingResult(); DefaultModelProblemCollector problems = new DefaultModelProblemCollector( result ); + // profile activation DefaultProfileActivationContext profileActivationContext = getProfileActivationContext( request ); problems.setSource( "(external profiles)" ); @@ -254,6 +256,7 @@ public class DefaultModelBuilder profileActivationContext.setUserProperties( profileProps ); } + // read and validate raw model Model inputModel = readModel( request.getModelSource(), request.getPomFile(), request, problems ); problems.setRootModel( inputModel ); @@ -275,6 +278,7 @@ public class DefaultModelBuilder problems.setSource( tmpModel ); + // model normalization modelNormalizer.mergeDuplicates( tmpModel, request, problems ); profileActivationContext.setProjectProperties( tmpModel.getProperties() ); @@ -286,6 +290,7 @@ public class DefaultModelBuilder Map interpolatedActivations = getProfileActivations( rawModel, false ); injectProfileActivations( tmpModel, interpolatedActivations ); + // profile injection for ( Profile activeProfile : activePomProfiles ) { profileInjector.injectProfile( tmpModel, activeProfile, request, problems ); @@ -354,6 +359,7 @@ public class DefaultModelBuilder problems.setSource( inputModel ); checkPluginVersions( lineage, request, problems ); + // inheritance assembly assembleInheritance( lineage, request, problems ); Model resultModel = resultData.getModel(); @@ -361,12 +367,14 @@ public class DefaultModelBuilder problems.setSource( resultModel ); problems.setRootModel( resultModel ); + // model interpolation resultModel = interpolateModel( resultModel, request, problems ); resultData.setModel( resultModel ); + // url normalization modelUrlNormalizer.normalize( resultModel, request ); - //Now the fully interpolated model is available reconfigure the resolver + // Now the fully interpolated model is available: reconfigure the resolver configureResolver( request.getModelResolver(), resultModel, problems , true ); resultData.setGroupId( resultModel.getGroupId() ); @@ -402,14 +410,17 @@ public class DefaultModelBuilder Collection imports ) throws ModelBuildingException { + // phase 2 Model resultModel = result.getEffectiveModel(); DefaultModelProblemCollector problems = new DefaultModelProblemCollector( result ); problems.setSource( resultModel ); problems.setRootModel( resultModel ); + // model path translation modelPathTranslator.alignToBaseDirectory( resultModel, resultModel.getProjectDirectory(), request ); + // plugin management injection pluginManagementInjector.injectManagement( resultModel, request, problems ); fireEvent( resultModel, request, problems, ModelBuildingEventCatapult.BUILD_EXTENSIONS_ASSEMBLED ); @@ -421,24 +432,31 @@ public class DefaultModelBuilder throw new IllegalStateException( "lifecycle bindings injector is missing" ); } + // lifecycle bindings injection lifecycleBindingsInjector.injectLifecycleBindings( resultModel, request, problems ); } + // dependency management import importDependencyManagement( resultModel, request, problems, imports ); + // dependency management injection dependencyManagementInjector.injectManagement( resultModel, request, problems ); modelNormalizer.injectDefaultValues( resultModel, request, problems ); if ( request.isProcessPlugins() ) { + // reports configuration reportConfigurationExpander.expandPluginConfiguration( resultModel, request, problems ); + // reports conversion to decoupled site plugin reportingConverter.convertReporting( resultModel, request, problems ); + // plugins configuration pluginConfigurationExpander.expandPluginConfiguration( resultModel, request, problems ); } + // effective model validation modelValidator.validateEffectiveModel( resultModel, request, problems ); if ( hasModelErrors( problems ) ) diff --git a/maven-model-builder/src/site/apt/index.apt b/maven-model-builder/src/site/apt/index.apt index 43265dd75f..64cb805cd0 100644 --- a/maven-model-builder/src/site/apt/index.apt +++ b/maven-model-builder/src/site/apt/index.apt @@ -35,23 +35,25 @@ Maven Model Builder {{{./xref/org/apache/maven/model/building/DefaultModelBuilder.html}source}}) that manages the steps sequence. - The sequence is divided into 2 phases, with optional plugin processing: + The sequence is divided into 2 phases: * phase 1 - ** raw model validation: <<>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}), - with its <<>> implementation - ({{{./xref/org/apache/maven/model/validation/DefaultModelValidator.html}source}}) - ** profile activation: see {{{./apidocs/org/apache/maven/model/profile/activation/package-summary.html}available activators}}. Notice that model interpolation hasn't happened yet, then interpolation for file-based activation is limited to <<<$\{basedir}>>> (since Maven 3), System properties and request properties - ** model normalization: <<>> ({{{./apidocs/org/apache/maven/model/normalization/ModelNormalizer.html}javadoc}}), + ** raw model validation: <<>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/validation/DefaultModelValidator.html}source}}) + + ** model normalization - merge duplicates: <<>> ({{{./apidocs/org/apache/maven/model/normalization/ModelNormalizer.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/normalization/DefaultModelNormalizer.html}source}}) - ** profile injection + ** profile injection: <<>> ({{{./apidocs/org/apache/maven/model/profile/ProfileInjector.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/profile/DefaultProfileInjector.html}source}}) ** parent resolution until {{{./super-pom.html}super-pom}} @@ -67,25 +69,41 @@ Maven Model Builder [] - * phase 2 + * phase 2, with optional plugin processing ** model path translation: <<>> ({{{./apidocs/org/apache/maven/model/path/ModelPathTranslator.html}javadoc}}), with its <<>> implementation ({{{./xref/org/apache/maven/model/path/DefaultModelPathTranslator.html}source}}) - ** plugin management injection + ** plugin management injection: <<>> ({{{./apidocs/org/apache/maven/model/management/PluginManagementInjector.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/management/DefaultPluginManagementInjector.html}source}}) - ** <(optional)> lifecycle bindings injection + ** <(optional)> lifecycle bindings injection: <<>> ({{{./apidocs/org/apache/maven/model/plugin/LifecycleBindingsInjector.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.html}source}}) ** dependency management import (for dependencies of type <<>> in the <<<\>>> section) - ** dependency management injection + ** dependency management injection: <<>> ({{{./apidocs/org/apache/maven/model/management/DependencyManagementInjector.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/management/DefaultDependencyManagementInjector.html}source}}) - ** <(optional)> reports configuration + ** model normalization - inject default values: <<>> ({{{./apidocs/org/apache/maven/model/normalization/ModelNormalizer.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/normalization/DefaultModelNormalizer.html}source}}) - ** <(optional)> reports conversion to decoupled site plugin + ** <(optional)> reports configuration: <<>> ({{{./apidocs/org/apache/maven/model/plugin/ReportConfigurationExpander.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.html}source}}) - ** <(optional)> plugins configuration + ** <(optional)> reports conversion to decoupled site plugin: <<>> ({{{./apidocs/org/apache/maven/model/plugin/ReportingConverter.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/plugin/DefaultReportingConverter.html}source}}) + + ** <(optional)> plugins configuration: <<>> ({{{./apidocs/org/apache/maven/model/plugin/PluginConfigurationExpander.html}javadoc}}), + with its <<>> implementation + ({{{./xref/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.html}source}}) ** effective model validation: <<>> ({{{./apidocs/org/apache/maven/model/validation/ModelValidator.html}javadoc}}), with its <<>> implementation