o Refactored model building components to use problem collector

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@800468 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-03 17:15:11 +00:00
parent bbc25fe83b
commit 62e07ca349
19 changed files with 102 additions and 125 deletions

View File

@ -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<Profile> 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.<Profile> 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<ModelData> lineage, ModelBuildingRequest request )
private void assembleInheritance( List<ModelData> 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 <T> void putCache( ModelCache modelCache, String groupId, String artifactId, String version,

View File

@ -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<? extends DependencyManagement> sources,
ModelBuildingRequest request )
ModelBuildingRequest request, ModelProblemCollector problems )
{
if ( sources != null && !sources.isEmpty() )
{

View File

@ -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 <code>null</code>.
* @param sources The dependency management sections to import, may be <code>null</code>.
* @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<? extends DependencyManagement> sources, ModelBuildingRequest request );
void importManagement( Model target, List<? extends DependencyManagement> sources, ModelBuildingRequest request,
ModelProblemCollector problems );
}

View File

@ -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<Object, Object> hints = new HashMap<Object, Object>();
hints.put( MavenModelMerger.CHILD_PATH_ADJUSTMENT, getChildPathAdjustment( child, parent ) );

View File

@ -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
* <code>null</code>.
* @param parent The (read-only) parent model from which to inherit the values, may be <code>null</code>.
* @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 );
}

View File

@ -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<? extends ValueSource> valueSources,
List<? extends InterpolationPostProcessor> postProcessors )
throws ModelInterpolationException
List<? extends InterpolationPostProcessor> 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();

View File

@ -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
* <p/>
* 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 );
}
}

View File

@ -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 );
}

View File

@ -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<Class<?>, Field[]> fieldsByClass = new WeakHashMap<Class<?>, Field[]>();
private static final Map<Class<?>, Boolean> fieldIsPrimitiveByClass = new WeakHashMap<Class<?>, 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<? extends InterpolationPostProcessor> 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<ModelInterpolationException>
private static final class InterpolateObjectAction implements PrivilegedAction<Object>
{
private final LinkedList<Object> interpolationTargets;
private final StringSearchModelInterpolator modelInterpolator;
private final List<? extends ValueSource> valueSources;
private final List<? extends InterpolationPostProcessor> postProcessors;
private final ModelProblemCollector problems;
public InterpolateObjectAction( Object target, List<? extends ValueSource> valueSources,
List<? extends InterpolationPostProcessor> 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 ) )
{

View File

@ -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 );
}

View File

@ -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 );
}

View File

@ -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 <code>null</code>.
* @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 );
}

View File

@ -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
* <code>null</code>.
* @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
* <code>null</code>.
* @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 );
}

View File

@ -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() );

View File

@ -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 <code>null</code>.
* @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 );
}

View File

@ -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();

View File

@ -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 <code>null</code>.
* @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 );
}

View File

@ -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 )
{

View File

@ -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 <code>null</code>.
* @param profile The (read-only) profile whose values should be injected, may be <code>null</code>.
* @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 );
}