Fixed some problems with inheritance of resources.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@757965 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2009-03-24 19:14:42 +00:00
parent b954b833e5
commit 1a294dff09
3 changed files with 42 additions and 47 deletions

View File

@ -145,18 +145,7 @@ public class DefaultMavenProjectBuilder
setBuildOutputDirectoryOnParent( project );
hm.put( ArtifactUtils.artifactId( project.getGroupId(), project.getArtifactId(), "pom", project.getVersion() ), project );
try
{
if("maven-project-builder".equals( project.getModel().getArtifactId())){
System.out.println(convertToDomainModel(project.getModel(), true).asString());
}
}
catch ( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return project;
}

View File

@ -65,10 +65,11 @@ public class BuildProcessor
copy(p.getBuild(), t.getBuild(), isProfile);
copy(build, t.getBuild(), isProfile);
copyResources(build, t.getBuild());
copyResources(p.getBuild(), t.getBuild());
copyResources(build, t.getBuild());
copyResources(p.getBuild(), t.getBuild());
pluginsProcessor.process( p.getBuild().getPlugins(), build.getPlugins(), t.getBuild().getPlugins(), isChildMostSpecialized );
inheritManagement(p.getBuild().getPluginManagement(), build.getPluginManagement(), t.getBuild());
}
@ -109,35 +110,7 @@ public class BuildProcessor
private static void copyResources(BuildBase source, Build target)
{
if(target.getResources().isEmpty())
{
for(Resource resource : source.getResources())
{
Resource r = new Resource();
r.setDirectory( resource.getDirectory());
r.setFiltering( resource.isFiltering() );
r.setMergeId( resource.getMergeId() );
r.setTargetPath( resource.getTargetPath() );
r.setExcludes( new ArrayList<String>(resource.getExcludes()) );
r.setIncludes( new ArrayList<String>(resource.getIncludes()) );
target.getResources().add( r );
}
}
if(target.getTestResources().isEmpty())
{
for(Resource resource : source.getTestResources())
{
Resource r = new Resource();
r.setDirectory( resource.getDirectory());
r.setFiltering( resource.isFiltering() );
r.setMergeId( resource.getMergeId() );
r.setTargetPath( resource.getTargetPath() );
r.setExcludes( new ArrayList<String>(resource.getExcludes()) );
r.setIncludes( new ArrayList<String>(resource.getIncludes()) );
target.getTestResources().add( r );
}
}
List<String> filters = new ArrayList<String>(target.getFilters());
for(String filter : source.getFilters())
@ -170,8 +143,41 @@ public class BuildProcessor
if(source.getDirectory() != null)
{
target.setDirectory( source.getDirectory() );
}
}
if(!source.getResources().isEmpty())
{
List<Resource> resources = new ArrayList<Resource>();
for(Resource resource : source.getResources())
{
Resource r = new Resource();
r.setDirectory( resource.getDirectory());
r.setFiltering( resource.isFiltering() );
r.setMergeId( resource.getMergeId() );
r.setTargetPath( resource.getTargetPath() );
r.setExcludes( new ArrayList<String>(resource.getExcludes()) );
r.setIncludes( new ArrayList<String>(resource.getIncludes()) );
resources.add( r );
}
target.setResources( resources );
}
if(!source.getTestResources().isEmpty())
{
List<Resource> resources = new ArrayList<Resource>();
for(Resource resource : source.getTestResources())
{
Resource r = new Resource();
r.setDirectory( resource.getDirectory());
r.setFiltering( resource.isFiltering() );
r.setMergeId( resource.getMergeId() );
r.setTargetPath( resource.getTargetPath() );
r.setExcludes( new ArrayList<String>(resource.getExcludes()) );
r.setIncludes( new ArrayList<String>(resource.getIncludes()) );
resources.add( r );
}
target.setTestResources( resources );
}
if(!isProfile)
{
copyBuild((Build) source, target);

View File

@ -960,7 +960,7 @@ public class PomConstructionTest
testCompleteModel( pom );
}
/* FIXME
/* FIXME*/
public void testCompleteModelWithParent()
throws Exception
{