Grzegorz Grzybek created MSHARED-293:
----------------------------------------

             Summary: Filtering doesn't work as expected after switching from 
maven-filtering:1.0-beta-2 to maven-filtering:1.1
                 Key: MSHARED-293
                 URL: https://jira.codehaus.org/browse/MSHARED-293
             Project: Maven Shared Components
          Issue Type: Bug
            Reporter: Grzegorz Grzybek


{{maven-filtering:1.0-beta-3}} introduced a setting 
{{org.apache.maven.shared.filtering.AbstractMavenFilteringRequest.injectProjectBuildFilters}}
 defaulted to {{false}}.

While constructing {{defaultFilterWrappers}} in 
{{org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(MavenProject, File)}} 
the {{MavenResourcesExecution}} is constructed.

In {{maven-filtering:1.0-beta-2}} there's unconditional call:
{code:java}
loadProperties( filterProperties, mavenProject.getBuild().getFilters(), 
baseProps );
{code}

In {{maven-filtering:1.1}}+ there's conditional call:
{code:java}
if ( request.isInjectProjectBuildFilters() )
{
    List<String> buildFilters = new ArrayList( 
request.getMavenProject().getBuild().getFilters() );
    buildFilters.removeAll( request.getFileFilters() );

    loadProperties( filterProperties, buildFilters, baseProps );
}
{code}

So my filters declared (as always) in:
{code:xml}
<build>
  <filters>
    <filter>../src/config/env/envX/config.properties</filter>
  </filters>
</build>
{code}
are *not taken into account* forcing me to set (configuration duplicate) 
[maven-war-plugin's 
filter|http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#filters] 
property.

Please change (in 
{{org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp()}}) the line:
{code:xml}
mavenResourcesExecution.setFilters( filters );
{code}
to
{code:xml}
mavenResourcesExecution.setFilters( filters == null ? 
project.getBuild().getFilters() : filters );
{code}

regards
Grzegorz Grzybek


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to