Index: main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java =================================================================== --- main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java (revision 1065498) +++ main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java (working copy) @@ -250,11 +250,14 @@ return defaultFilterWrappers; } - private void loadProperties( Properties filterProperties, List /* String */propertiesFilePaths, Properties baseProps ) + protected void loadProperties( Properties filterProperties, List /* String */propertiesFilePaths, Properties baseProps ) throws MavenFilteringException { if ( propertiesFilePaths != null ) { + Properties workProperties = new Properties(); + workProperties.putAll(baseProps); + for ( Iterator iterator = propertiesFilePaths.iterator(); iterator.hasNext(); ) { String filterFile = (String) iterator.next(); @@ -266,8 +269,9 @@ try { // TODO new File should be new File(mavenProject.getBasedir(), filterfile ) ? - Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), baseProps ); + Properties properties = PropertyUtils.loadPropertyFile( new File( filterFile ), workProperties ); filterProperties.putAll( properties ); + workProperties.putAll(properties); } catch ( IOException e ) { Index: test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java =================================================================== --- test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java (revision 1065498) +++ test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java (working copy) @@ -1,6 +1,8 @@ package org.apache.maven.shared.filtering; import java.io.File; +import java.util.ArrayList; +import java.util.List; import java.util.Properties; import org.codehaus.plexus.PlexusTestCase; @@ -32,7 +34,7 @@ public class DefaultMavenFileFilterTest extends PlexusTestCase { - + File to = new File( getBasedir(), "target/reflection-test.properties" ); protected void setUp() @@ -101,4 +103,23 @@ // shouldn't fail } + public void testMultiFilterFileInheritance() + throws Exception + { + DefaultMavenFileFilter mavenFileFilter = new DefaultMavenFileFilter(); + + File testDir = new File(getBasedir(), "src/test/units-files/MSHARED-177"); + + List filters = new ArrayList(); + + filters.add(new File(testDir, "first_filter_file.properties").getAbsolutePath()); + filters.add(new File(testDir, "second_filter_file.properties").getAbsolutePath()); + filters.add(new File(testDir, "third_filter_file.properties").getAbsolutePath()); + + final Properties filterProperties = new Properties(); + + mavenFileFilter.loadProperties(filterProperties, filters, new Properties() ); + + assertTrue( filterProperties.getProperty( "third_filter_key" ).equals( "first and second" ) ); + } } Index: test/units-files/MSHARED-177/first_filter_file.properties =================================================================== --- test/units-files/MSHARED-177/first_filter_file.properties (revision 0) +++ test/units-files/MSHARED-177/first_filter_file.properties (revision 0) @@ -0,0 +1,13 @@ +# Licensed 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. +# under the License. +first_filter_key=first \ No newline at end of file Index: test/units-files/MSHARED-177/second_filter_file.properties =================================================================== --- test/units-files/MSHARED-177/second_filter_file.properties (revision 0) +++ test/units-files/MSHARED-177/second_filter_file.properties (revision 0) @@ -0,0 +1,15 @@ +# Licensed 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. +# under the License. +second_filter_key=second + + Index: test/units-files/MSHARED-177/third_filter_file.properties =================================================================== --- test/units-files/MSHARED-177/third_filter_file.properties (revision 0) +++ test/units-files/MSHARED-177/third_filter_file.properties (revision 0) @@ -0,0 +1,13 @@ +# Licensed 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. +# under the License. +third_filter_key=${first_filter_key} and ${second_filter_key}