[ 
https://jira.codehaus.org/browse/MWAR-305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=333887#comment-333887
 ] 

Juan Miguel Bernal Gonzalez commented on MWAR-305:
--------------------------------------------------

Thank's Grzegorz, you are right.

In the page [Adding Filtering 
Webresources|http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html]
 of the *maven-war-plugin* documentation, section *Filtering*, you say:

{code}
  ...
        <configuration>
          <!-- the default value is the filter list under build -->
          <!-- specifying a filter will override the filter list under build -->
          <filters>
            <filter>properties/config.prop</filter>
          </filters>
          <nonFilteredFileExtensions>
            <!-- default value contains jpg,jpeg,gif,bmp,png -->
            <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
          <webResources>
            <resource>
              <directory>resource2</directory>
              <!-- it's not a good idea to filter binary files -->
              <filtering>false</filtering>
            </resource>
            <resource>
              <directory>configurations</directory>
              <!-- enable filtering -->
              <filtering>true</filtering>
              <excludes>
                <exclude>**/properties</exclude>
              </excludes>
            </resource>
          </webResources>
        </configuration>
        ...
{code}

but now, it isn't achieve this functionality.
                
> Filtering doesn't work as expected after switching from 
> maven-filtering:1.0-beta-2 to maven-filtering:1.1 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: MWAR-305
>                 URL: https://jira.codehaus.org/browse/MWAR-305
>             Project: Maven WAR Plugin
>          Issue Type: Bug
>            Reporter: Grzegorz Grzybek
>            Priority: Critical
>
> {{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