mirror of https://github.com/apache/maven.git
[MNG-2591 - Plugin config inheritance.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@758121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
98ed6538fa
commit
fc83f1f70b
|
@ -257,20 +257,7 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
request.setRemoteRepostories( new ArrayList<ArtifactRepository>() );
|
||||
}
|
||||
/*
|
||||
if(project.getRemoteArtifactRepositories() == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println(convertToDomainModel(project.getModel(), true).asString());
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
ArtifactResolutionResult result = repositorySystem.resolve( request );
|
||||
|
||||
if ( result.hasExceptions() )
|
||||
|
@ -323,19 +310,21 @@ public class DefaultMavenProjectBuilder
|
|||
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor, e );
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PomClassicDomainModel dm = ProcessorContext.mergeProfilesIntoModel( projectProfiles, model, false );
|
||||
ProcessorContext.interpolateModelProperties( dm.getModelProperties(),
|
||||
new ArrayList<InterpolatorProperty>(), dm );
|
||||
dm = new PomClassicDomainModel( dm.getModelProperties(), false );
|
||||
model = dm.getModel();
|
||||
}
|
||||
catch ( IOException e )
|
||||
if(!projectProfiles.isEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
PomClassicDomainModel dm = ProcessorContext.mergeProfilesIntoModel( projectProfiles, model, false );
|
||||
ProcessorContext.interpolateModelProperties( dm.getModelProperties(),
|
||||
new ArrayList<InterpolatorProperty>(), dm );
|
||||
dm = new PomClassicDomainModel( dm.getModelProperties(), false );
|
||||
model = dm.getModel();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
||||
throw new ProjectBuildingException(projectId, "", projectDescriptor, e);
|
||||
throw new ProjectBuildingException(projectId, "", projectDescriptor, e);
|
||||
}
|
||||
}
|
||||
|
||||
MavenProject project;
|
||||
|
|
|
@ -21,7 +21,9 @@ package org.apache.maven.project.processor;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.DependencyManagement;
|
||||
|
@ -43,7 +45,7 @@ public class ModelProcessor
|
|||
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
|
||||
{
|
||||
super.process( parent, child, target, isChildMostSpecialized );
|
||||
|
||||
|
||||
Model c = (Model) child;
|
||||
Model t = (Model) target;
|
||||
Model p = null;
|
||||
|
@ -151,6 +153,5 @@ public class ModelProcessor
|
|||
}
|
||||
t.getDependencyManagement().getDependencies().addAll( mngDeps );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class PluginProcessor
|
|||
//TODO: Not copying
|
||||
if(target.getConfiguration() != null)
|
||||
{
|
||||
target.setConfiguration( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) source.getConfiguration(), (Xpp3Dom) target.getConfiguration() ));
|
||||
target.setConfiguration( Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) source.getConfiguration(), (Xpp3Dom) target.getConfiguration() ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ public class PluginsManagementProcessor extends BaseProcessor
|
|||
{
|
||||
for(Plugin targetDep : targetPlugin)
|
||||
{ //PluginManagement is first in ordering
|
||||
if(match(depMng, targetDep))
|
||||
if(match(depMng, targetDep) )
|
||||
{
|
||||
copy(depMng, targetDep );
|
||||
}
|
||||
|
|
|
@ -251,12 +251,14 @@ public class ProcessorContext
|
|||
}
|
||||
|
||||
// Plugin Management
|
||||
|
||||
PluginsManagementProcessor procMng = new PluginsManagementProcessor();
|
||||
if ( target.getBuild() != null && target.getBuild().getPluginManagement() != null)
|
||||
{
|
||||
procMng.process( null, new ArrayList<Plugin>( target.getBuild().getPluginManagement().getPlugins() ),
|
||||
target.getBuild().getPlugins(), true );
|
||||
}
|
||||
|
||||
return target;
|
||||
|
||||
}
|
||||
|
|
|
@ -258,7 +258,6 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "equal-plugin-exec-ids" );
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
assertEquals( "maven-it-plugin-a", pom.getValue( "build/plugins[1]/artifactId" ) );
|
||||
assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
|
||||
assertEquals( "maven-it-plugin-b", pom.getValue( "build/plugins[2]/artifactId" ) );
|
||||
|
@ -498,7 +497,7 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "merged-plugin-class-path-order/wo-plugin-mngt/sub" );
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
|
||||
assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/dependencies" ) ).size() );
|
||||
assertNotNull( pom.getValue( "build/plugins[1]/dependencies[1]" ));
|
||||
assertEquals( "c", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) );
|
||||
|
@ -627,7 +626,7 @@ public class PomConstructionTest
|
|||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "unprefixed-expression-interpolation/child" );
|
||||
System.out.println(pom.getDomainModel().asString());
|
||||
|
||||
assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/projectDir" ).toString() ) );
|
||||
|
||||
assertEquals( "org.apache.maven.its.mng3831.child", pom.getValue( "properties/projectGroupId" ) );
|
||||
|
@ -761,11 +760,12 @@ public class PomConstructionTest
|
|||
assertEquals( "PASSED-4", pom.getValue( prefix + "listParam/listParam[4]" ) );
|
||||
}
|
||||
|
||||
/* FIXME: MNG-2591
|
||||
/* FIXME: MNG-2591*/
|
||||
public void testAppendOfInheritedPluginConfiguration()
|
||||
throws Exception
|
||||
{
|
||||
PomTestWrapper pom = buildPom( "plugin-config-append/subproject" );
|
||||
|
||||
String prefix = "build/plugins[1]/configuration/";
|
||||
assertEquals( "PARENT-1", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
|
||||
assertEquals( "PARENT-3", pom.getValue( prefix + "stringParams/stringParam[2]" ) );
|
||||
|
|
Loading…
Reference in New Issue