[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:
Britton Isbell 2009-03-25 01:39:38 +00:00
parent 98ed6538fa
commit fc83f1f70b
6 changed files with 25 additions and 33 deletions

View File

@ -257,20 +257,7 @@ public class DefaultMavenProjectBuilder
{ {
request.setRemoteRepostories( new ArrayList<ArtifactRepository>() ); 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 ); ArtifactResolutionResult result = repositorySystem.resolve( request );
if ( result.hasExceptions() ) if ( result.hasExceptions() )
@ -323,7 +310,8 @@ public class DefaultMavenProjectBuilder
throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor, e ); throw new ProjectBuildingException( projectId, "Failed to activate external profiles.", projectDescriptor, e );
} }
} }
if(!projectProfiles.isEmpty())
{
try try
{ {
PomClassicDomainModel dm = ProcessorContext.mergeProfilesIntoModel( projectProfiles, model, false ); PomClassicDomainModel dm = ProcessorContext.mergeProfilesIntoModel( projectProfiles, model, false );
@ -337,6 +325,7 @@ public class DefaultMavenProjectBuilder
throw new ProjectBuildingException(projectId, "", projectDescriptor, e); throw new ProjectBuildingException(projectId, "", projectDescriptor, e);
} }
}
MavenProject project; MavenProject project;

View File

@ -21,7 +21,9 @@ package org.apache.maven.project.processor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.DependencyManagement;
@ -151,6 +153,5 @@ public class ModelProcessor
} }
t.getDependencyManagement().getDependencies().addAll( mngDeps ); t.getDependencyManagement().getDependencies().addAll( mngDeps );
} }
} }
} }

View File

@ -251,12 +251,14 @@ public class ProcessorContext
} }
// Plugin Management // Plugin Management
PluginsManagementProcessor procMng = new PluginsManagementProcessor(); PluginsManagementProcessor procMng = new PluginsManagementProcessor();
if ( target.getBuild() != null && target.getBuild().getPluginManagement() != null) if ( target.getBuild() != null && target.getBuild().getPluginManagement() != null)
{ {
procMng.process( null, new ArrayList<Plugin>( target.getBuild().getPluginManagement().getPlugins() ), procMng.process( null, new ArrayList<Plugin>( target.getBuild().getPluginManagement().getPlugins() ),
target.getBuild().getPlugins(), true ); target.getBuild().getPlugins(), true );
} }
return target; return target;
} }

View File

@ -258,7 +258,6 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "equal-plugin-exec-ids" ); 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( "maven-it-plugin-a", pom.getValue( "build/plugins[1]/artifactId" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() ); assertEquals( 1, ( (List<?>) pom.getValue( "build/plugins[1]/executions" ) ).size() );
assertEquals( "maven-it-plugin-b", pom.getValue( "build/plugins[2]/artifactId" ) ); assertEquals( "maven-it-plugin-b", pom.getValue( "build/plugins[2]/artifactId" ) );
@ -498,7 +497,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "merged-plugin-class-path-order/wo-plugin-mngt/sub" ); 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() ); assertEquals( 5, ( (List<?>) pom.getValue( "build/plugins[1]/dependencies" ) ).size() );
assertNotNull( pom.getValue( "build/plugins[1]/dependencies[1]" )); assertNotNull( pom.getValue( "build/plugins[1]/dependencies[1]" ));
assertEquals( "c", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) ); assertEquals( "c", pom.getValue( "build/plugins[1]/dependencies[1]/artifactId" ) );
@ -627,7 +626,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "unprefixed-expression-interpolation/child" ); PomTestWrapper pom = buildPom( "unprefixed-expression-interpolation/child" );
System.out.println(pom.getDomainModel().asString());
assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/projectDir" ).toString() ) ); assertEquals( pom.getBasedir(), new File( pom.getValue( "properties/projectDir" ).toString() ) );
assertEquals( "org.apache.maven.its.mng3831.child", pom.getValue( "properties/projectGroupId" ) ); 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]" ) ); assertEquals( "PASSED-4", pom.getValue( prefix + "listParam/listParam[4]" ) );
} }
/* FIXME: MNG-2591 /* FIXME: MNG-2591*/
public void testAppendOfInheritedPluginConfiguration() public void testAppendOfInheritedPluginConfiguration()
throws Exception throws Exception
{ {
PomTestWrapper pom = buildPom( "plugin-config-append/subproject" ); PomTestWrapper pom = buildPom( "plugin-config-append/subproject" );
String prefix = "build/plugins[1]/configuration/"; String prefix = "build/plugins[1]/configuration/";
assertEquals( "PARENT-1", pom.getValue( prefix + "stringParams/stringParam[1]" ) ); assertEquals( "PARENT-1", pom.getValue( prefix + "stringParams/stringParam[1]" ) );
assertEquals( "PARENT-3", pom.getValue( prefix + "stringParams/stringParam[2]" ) ); assertEquals( "PARENT-3", pom.getValue( prefix + "stringParams/stringParam[2]" ) );