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 9b919991cb..e6da800d08 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 @@ -35,7 +35,6 @@ import org.apache.maven.model.Profile; import org.apache.maven.model.Repository; import org.apache.maven.model.composition.DependencyManagementImporter; import org.apache.maven.model.inheritance.InheritanceAssembler; -import org.apache.maven.model.interpolation.ModelInterpolationException; import org.apache.maven.model.interpolation.ModelInterpolator; import org.apache.maven.model.io.ModelParseException; import org.apache.maven.model.io.ModelReader; @@ -137,7 +136,7 @@ public class DefaultModelBuilder problems.setSourceHint( tmpModel ); - modelNormalizer.mergeDuplicates( tmpModel, request ); + modelNormalizer.mergeDuplicates( tmpModel, request, problems ); List activePomProfiles = profileSelector.getActiveProfiles( rawModel.getProfiles(), profileActivationContext, problems ); @@ -145,14 +144,14 @@ public class DefaultModelBuilder for ( Profile activeProfile : activePomProfiles ) { - profileInjector.injectProfile( tmpModel, activeProfile, request ); + profileInjector.injectProfile( tmpModel, activeProfile, request, problems ); } if ( currentData == resultData ) { for ( Profile activeProfile : activeExternalProfiles ) { - profileInjector.injectProfile( tmpModel, activeProfile, request ); + profileInjector.injectProfile( tmpModel, activeProfile, request, problems ); } } @@ -166,7 +165,7 @@ public class DefaultModelBuilder superData.setActiveProfiles( Collections. emptyList() ); lineage.add( superData ); - assembleInheritance( lineage, request ); + assembleInheritance( lineage, request, problems ); Model resultModel = resultData.getModel(); @@ -212,7 +211,7 @@ public class DefaultModelBuilder modelPathTranslator.alignToBaseDirectory( resultModel, resultModel.getProjectDirectory(), request ); - pluginManagementInjector.injectBasicManagement( resultModel, request ); + pluginManagementInjector.injectBasicManagement( resultModel, request, problems ); fireBuildExtensionsAssembled( resultModel, request, problems ); @@ -221,17 +220,17 @@ public class DefaultModelBuilder lifecycleBindingsInjector.injectLifecycleBindings( resultModel, problems ); } - pluginManagementInjector.injectManagement( resultModel, request ); + pluginManagementInjector.injectManagement( resultModel, request, problems ); importDependencyManagement( resultModel, request, problems ); - dependencyManagementInjector.injectManagement( resultModel, request ); + dependencyManagementInjector.injectManagement( resultModel, request, problems ); - modelNormalizer.injectDefaultValues( resultModel, request ); + modelNormalizer.injectDefaultValues( resultModel, request, problems ); if ( request.isProcessPlugins() ) { - pluginConfigurationExpander.expandPluginConfiguration( resultModel, request ); + pluginConfigurationExpander.expandPluginConfiguration( resultModel, request, problems ); } modelValidator.validateEffectiveModel( resultModel, request, problems ); @@ -345,30 +344,22 @@ public class DefaultModelBuilder } } - private void assembleInheritance( List lineage, ModelBuildingRequest request ) + private void assembleInheritance( List lineage, ModelBuildingRequest request, + ModelProblemCollector problems ) { for ( int i = lineage.size() - 2; i >= 0; i-- ) { Model parent = lineage.get( i + 1 ).getModel(); Model child = lineage.get( i ).getModel(); - inheritanceAssembler.assembleModelInheritance( child, parent, request ); + inheritanceAssembler.assembleModelInheritance( child, parent, request, problems ); } } private Model interpolateModel( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { - try - { - Model result = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request ); - result.setPomFile( model.getPomFile() ); - return result; - } - catch ( ModelInterpolationException e ) - { - problems.addError( "Invalid expression: " + e.getMessage(), e ); - - return model; - } + Model result = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems ); + result.setPomFile( model.getPomFile() ); + return result; } private ModelData readParent( Model childModel, ModelBuildingRequest request, DefaultModelProblemCollector problems ) @@ -635,7 +626,7 @@ public class DefaultModelBuilder importMngts.add( importMngt ); } - dependencyManagementImporter.importManagement( model, importMngts, request ); + dependencyManagementImporter.importManagement( model, importMngts, request, problems ); } private void putCache( ModelCache modelCache, String groupId, String artifactId, String version, diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java b/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java index 6cb0bd92cd..a61eba32f0 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java @@ -28,6 +28,7 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.codehaus.plexus.component.annotations.Component; /** @@ -41,7 +42,7 @@ public class DefaultDependencyManagementImporter { public void importManagement( Model target, List sources, - ModelBuildingRequest request ) + ModelBuildingRequest request, ModelProblemCollector problems ) { if ( sources != null && !sources.isEmpty() ) { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java b/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java index 18c52bfe7e..b6cd7b91d8 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles the import of dependency management from other models into the target model. @@ -39,7 +40,9 @@ public interface DependencyManagementImporter * @param target The model into which to import the dependency management section, must not be null. * @param sources The dependency management sections to import, may be null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void importManagement( Model target, List sources, ModelBuildingRequest request ); + void importManagement( Model target, List sources, ModelBuildingRequest request, + ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java index 524c7d2cdc..cb4c482675 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java @@ -32,6 +32,7 @@ import org.apache.maven.model.PluginContainer; import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.Reporting; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.merge.MavenModelMerger; import org.codehaus.plexus.component.annotations.Component; @@ -47,7 +48,8 @@ public class DefaultInheritanceAssembler private InheritanceModelMerger merger = new InheritanceModelMerger(); - public void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request ) + public void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request, + ModelProblemCollector problems ) { Map hints = new HashMap(); hints.put( MavenModelMerger.CHILD_PATH_ADJUSTMENT, getChildPathAdjustment( child, parent ) ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java index 6693d569f0..9ce5d783b8 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java @@ -21,6 +21,7 @@ package org.apache.maven.model.inheritance; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles inheritance of model values. @@ -39,7 +40,9 @@ public interface InheritanceAssembler * null. * @param parent The (read-only) parent model from which to inherit the values, may be null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request ); + void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request, + ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java index 83045a41c8..8b660b872b 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java @@ -21,6 +21,7 @@ package org.apache.maven.model.interpolation; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.path.PathTranslator; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.interpolation.AbstractValueSource; @@ -187,8 +188,8 @@ public abstract class AbstractStringBasedModelInterpolator } protected String interpolateInternal( String src, List valueSources, - List postProcessors ) - throws ModelInterpolationException + List postProcessors, + ModelProblemCollector problems ) { if ( src.indexOf( "${" ) < 0 ) { @@ -215,9 +216,9 @@ public abstract class AbstractStringBasedModelInterpolator { result = interpolator.interpolate( result, recursionInterceptor ); } - catch( InterpolationException e ) + catch ( InterpolationException e ) { - throw new ModelInterpolationException( e.getMessage(), e ); + problems.addError( e.getMessage(), e ); } interpolator.clearFeedback(); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolationException.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolationException.java deleted file mode 100644 index 1fcfe92e13..0000000000 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolationException.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.maven.model.interpolation; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * @author jdcasey - *

- * Created on Feb 2, 2005 - */ -@SuppressWarnings("serial") -public class ModelInterpolationException - extends Exception -{ - - public ModelInterpolationException( String message ) - { - super( message ); - } - - public ModelInterpolationException( String message, Throwable cause ) - { - super( message, cause ); - } - -} \ No newline at end of file diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java index ded543fecc..53d3641a31 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java @@ -21,6 +21,7 @@ package org.apache.maven.model.interpolation; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import java.io.File; @@ -44,11 +45,9 @@ public interface ModelInterpolator * @param projectDir The project directory, may be {@code null} if the model does not belong to a local project but * to some artifact's metadata. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. * @return The interpolated model, never {@code null}. - * @throws ModelInterpolationException If the model could not be interpolated (e.g. due to expressions with cyclic - * references). */ - Model interpolateModel( Model model, File projectDir, ModelBuildingRequest request ) - throws ModelInterpolationException; + Model interpolateModel( Model model, File projectDir, ModelBuildingRequest request, ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java index e68e18b2cf..a2656fbf54 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java @@ -21,6 +21,7 @@ package org.apache.maven.model.interpolation; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.interpolation.InterpolationPostProcessor; import org.codehaus.plexus.interpolation.Interpolator; @@ -47,16 +48,15 @@ public class StringSearchModelInterpolator private static final Map, Field[]> fieldsByClass = new WeakHashMap, Field[]>(); private static final Map, Boolean> fieldIsPrimitiveByClass = new WeakHashMap, Boolean>(); - public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config ) - throws ModelInterpolationException + public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config, + ModelProblemCollector problems ) { - interpolateObject( model, model, projectDir, config ); + interpolateObject( model, model, projectDir, config, problems ); return model; } - protected void interpolateObject( Object obj, Model model, File projectDir, ModelBuildingRequest config ) - throws ModelInterpolationException + protected void interpolateObject( Object obj, Model model, File projectDir, ModelBuildingRequest config, ModelProblemCollector problems ) { try { @@ -64,14 +64,9 @@ public class StringSearchModelInterpolator List postProcessors = createPostProcessors( model, projectDir, config ); InterpolateObjectAction action = - new InterpolateObjectAction( obj, valueSources, postProcessors, this ); + new InterpolateObjectAction( obj, valueSources, postProcessors, this, problems ); - ModelInterpolationException error = AccessController.doPrivileged( action ); - - if ( error != null ) - { - throw error; - } + AccessController.doPrivileged( action ); } finally { @@ -87,17 +82,18 @@ public class StringSearchModelInterpolator return interpolator; } - private static final class InterpolateObjectAction implements PrivilegedAction + private static final class InterpolateObjectAction implements PrivilegedAction { private final LinkedList interpolationTargets; private final StringSearchModelInterpolator modelInterpolator; private final List valueSources; private final List postProcessors; + private final ModelProblemCollector problems; public InterpolateObjectAction( Object target, List valueSources, List postProcessors, - StringSearchModelInterpolator modelInterpolator ) + StringSearchModelInterpolator modelInterpolator, ModelProblemCollector problems ) { this.valueSources = valueSources; this.postProcessors = postProcessors; @@ -106,22 +102,17 @@ public class StringSearchModelInterpolator interpolationTargets.add( target ); this.modelInterpolator = modelInterpolator; + + this.problems = problems; } - public ModelInterpolationException run() + public Object run() { while( !interpolationTargets.isEmpty() ) { Object obj = interpolationTargets.removeFirst(); - try - { - traverseObjectWithParents( obj.getClass(), obj ); - } - catch ( ModelInterpolationException e ) - { - return e; - } + traverseObjectWithParents( obj.getClass(), obj ); } return null; @@ -129,7 +120,6 @@ public class StringSearchModelInterpolator @SuppressWarnings("unchecked") private void traverseObjectWithParents( Class cls, Object target ) - throws ModelInterpolationException { if ( cls == null ) { @@ -166,7 +156,9 @@ public class StringSearchModelInterpolator String value = (String) fields[i].get( target ); if ( value != null ) { - String interpolated = modelInterpolator.interpolateInternal( value, valueSources, postProcessors ); + String interpolated = + modelInterpolator.interpolateInternal( value, valueSources, postProcessors, + problems ); if ( !interpolated.equals( value ) ) { @@ -195,7 +187,10 @@ public class StringSearchModelInterpolator { if( String.class == value.getClass() ) { - String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors ); + String interpolated = + modelInterpolator.interpolateInternal( (String) value, + valueSources, + postProcessors, problems ); if ( !interpolated.equals( value ) ) { @@ -240,7 +235,10 @@ public class StringSearchModelInterpolator { if( String.class == value.getClass() ) { - String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors ); + String interpolated = + modelInterpolator.interpolateInternal( (String) value, + valueSources, + postProcessors, problems ); if ( !interpolated.equals( value ) ) { @@ -287,11 +285,13 @@ public class StringSearchModelInterpolator } catch ( IllegalArgumentException e ) { - throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + " on class: " + cls.getName(), e ); + problems.addError( "Failed to interpolate field: " + fields[i] + " on class: " + + cls.getName(), e ); } catch ( IllegalAccessException e ) { - throw new ModelInterpolationException( "Failed to interpolate field: " + fields[i] + " on class: " + cls.getName(), e ); + problems.addError( "Failed to interpolate field: " + fields[i] + " on class: " + + cls.getName(), e ); } } finally @@ -336,7 +336,6 @@ public class StringSearchModelInterpolator } private void evaluateArray( Object target ) - throws ModelInterpolationException { int len = Array.getLength( target ); for( int i = 0; i < len; i++ ) @@ -346,7 +345,9 @@ public class StringSearchModelInterpolator { if ( String.class == value.getClass() ) { - String interpolated = modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors ); + String interpolated = + modelInterpolator.interpolateInternal( (String) value, valueSources, postProcessors, + problems ); if ( !interpolated.equals( value ) ) { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java index acf43f4702..ba3a49ca62 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java @@ -30,6 +30,7 @@ import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.Exclusion; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.merge.MavenModelMerger; import org.codehaus.plexus.component.annotations.Component; @@ -45,7 +46,7 @@ public class DefaultDependencyManagementInjector private ManagementModelMerger merger = new ManagementModelMerger(); - public void injectManagement( Model model, ModelBuildingRequest request ) + public void injectManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { merger.mergeManagedDependencies( model ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java index 58ca7ba071..891add1ad6 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java @@ -33,6 +33,7 @@ import org.apache.maven.model.PluginContainer; import org.apache.maven.model.PluginExecution; import org.apache.maven.model.PluginManagement; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.merge.MavenModelMerger; import org.codehaus.plexus.component.annotations.Component; @@ -48,12 +49,12 @@ public class DefaultPluginManagementInjector private ManagementModelMerger merger = new ManagementModelMerger(); - public void injectManagement( Model model, ModelBuildingRequest request ) + public void injectManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { merger.mergeManagedBuildPlugins( model, false ); } - public void injectBasicManagement( Model model, ModelBuildingRequest request ) + public void injectBasicManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { merger.mergeManagedBuildPlugins( model, true ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java index 649f0136f4..d9c9501134 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java @@ -21,6 +21,7 @@ package org.apache.maven.model.management; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles injection of dependency management into the model. @@ -36,7 +37,8 @@ public interface DependencyManagementInjector * @param child The model into which to merge the values specified by its dependency management sections, must not * be null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void injectManagement( Model child, ModelBuildingRequest request ); + void injectManagement( Model child, ModelBuildingRequest request, ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java index d53aba12d5..a6dec27918 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java @@ -21,6 +21,7 @@ package org.apache.maven.model.management; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles injection of plugin management into the model. @@ -36,8 +37,9 @@ public interface PluginManagementInjector * @param child The model into which to merge the values specified by its plugin management section, must not be * null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void injectManagement( Model child, ModelBuildingRequest request ); + void injectManagement( Model child, ModelBuildingRequest request, ModelProblemCollector problems ); /** * Merges important default values from the plugin management section of the given model into itself. In detail, @@ -47,7 +49,8 @@ public interface PluginManagementInjector * @param child The model into which to merge the values specified by its plugin management section, must not be * null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void injectBasicManagement( Model child, ModelBuildingRequest request ); + void injectBasicManagement( Model child, ModelBuildingRequest request, ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java index 73f4544037..28ad2103cc 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java @@ -30,6 +30,7 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.merge.MavenModelMerger; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.StringUtils; @@ -46,7 +47,7 @@ public class DefaultModelNormalizer private DuplicateMerger merger = new DuplicateMerger(); - public void mergeDuplicates( Model model, ModelBuildingRequest request ) + public void mergeDuplicates( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { Build build = model.getBuild(); if ( build != null ) @@ -95,7 +96,7 @@ public class DefaultModelNormalizer } - public void injectDefaultValues( Model model, ModelBuildingRequest request ) + public void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { injectDependencyDefaults( model.getDependencies() ); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java b/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java index 7a8894d998..a2e642e483 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java @@ -21,6 +21,7 @@ package org.apache.maven.model.normalization; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles normalization of a model. In this context, normalization is the process of producing a canonical @@ -34,10 +35,11 @@ public interface ModelNormalizer /** * Merges duplicate elements like multiple declarations of the same build plugin in the specified model. * - * @param model The model whose duplicate elements should be merged, must not be null. + * @param model The model whose duplicate elements should be merged, must not be {@code null}. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void mergeDuplicates( Model model, ModelBuildingRequest request ); + void mergeDuplicates( Model model, ModelBuildingRequest request, ModelProblemCollector problems ); /** * Sets default values in the specified model that for technical reasons cannot be set directly in the Modello @@ -45,7 +47,8 @@ public interface ModelNormalizer * * @param model The model in which to set the default values, must not be {@code null}. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void injectDefaultValues( Model model, ModelBuildingRequest request ); + void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java index c99d91e7f3..1b4f12cc80 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java @@ -27,6 +27,7 @@ import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.ReportSet; import org.apache.maven.model.Reporting; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.xml.Xpp3Dom; @@ -40,7 +41,7 @@ public class DefaultPluginConfigurationExpander implements PluginConfigurationExpander { - public void expandPluginConfiguration( Model model, ModelBuildingRequest request ) + public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { Build build = model.getBuild(); Reporting reporting = model.getReporting(); diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java index b8bba03958..6dde5239e7 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java @@ -21,6 +21,7 @@ package org.apache.maven.model.plugin; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles expansion of general plugin configuration into individual executions and report sets. @@ -36,7 +37,8 @@ public interface PluginConfigurationExpander * * @param model The model whose plugin configuration should be expanded, must not be null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void expandPluginConfiguration( Model model, ModelBuildingRequest request ); + void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems ); } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java index 1e6bebad69..61336181b4 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java @@ -36,6 +36,7 @@ import org.apache.maven.model.Profile; import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.Reporting; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.merge.MavenModelMerger; import org.codehaus.plexus.component.annotations.Component; @@ -51,7 +52,8 @@ public class DefaultProfileInjector private ProfileModelMerger merger = new ProfileModelMerger(); - public void injectProfile( Model model, Profile profile, ModelBuildingRequest request ) + public void injectProfile( Model model, Profile profile, ModelBuildingRequest request, + ModelProblemCollector problems ) { if ( profile != null ) { diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java index 19f37097f8..5c1e8eae00 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java @@ -22,6 +22,7 @@ package org.apache.maven.model.profile; import org.apache.maven.model.Model; import org.apache.maven.model.Profile; import org.apache.maven.model.building.ModelBuildingRequest; +import org.apache.maven.model.building.ModelProblemCollector; /** * Handles profile injection into the model. @@ -38,7 +39,8 @@ public interface ProfileInjector * @param model The model into which to merge the values defined by the profile, must not be null. * @param profile The (read-only) profile whose values should be injected, may be null. * @param request The model building request that holds further settings, must not be {@code null}. + * @param problems The container used to collect problems that were encountered, must not be {@code null}. */ - void injectProfile( Model model, Profile profile, ModelBuildingRequest request ); + void injectProfile( Model model, Profile profile, ModelBuildingRequest request, ModelProblemCollector problems ); }