Uploaded image for project: 'Maven WAR Plugin'
  1. Maven WAR Plugin
  2. MWAR-305

Filtering doesn't work as expected after switching from maven-filtering:1.0-beta-2 to maven-filtering:1.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 2.5
    • None
    • None

    Description

      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:

      loadProperties( filterProperties, mavenProject.getBuild().getFilters(), baseProps );
      

      In maven-filtering:1.1+ there's conditional call:

      if ( request.isInjectProjectBuildFilters() )
      {
          List<String> buildFilters = new ArrayList( request.getMavenProject().getBuild().getFilters() );
          buildFilters.removeAll( request.getFileFilters() );
      
          loadProperties( filterProperties, buildFilters, baseProps );
      }
      

      So my filters declared (as always) in:

      <build>
        <filters>
          <filter>../src/config/env/envX/config.properties</filter>
        </filters>
      </build>
      

      are not taken into account forcing me to set (configuration duplicate) maven-war-plugin's filter property.

      Please change (in org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp()) the line:

      mavenResourcesExecution.setFilters( filters );
      

      to

      mavenResourcesExecution.setFilters( filters == null ? project.getBuild().getFilters() : filters );
      

      regards
      Grzegorz Grzybek

      Attachments

        Issue Links

          Activity

            People

              khmarbaise Karl Heinz Marbaise
              ggrzybek Grzegorz Grzybek
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: