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

War plugin doesn't honour system or project properties when filtering resource files.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1
    • 2.0.1
    • None
    • None
    • osx 10.4.6, java 1.4.2_06

    Description

      The war plugin only honours properties specified in a properties file, identified in a build/filters/filter element.

      To be consistent with regular resource filtering, it should honour properties specified on the CL, in a profile, in a plugin, or in the pom (eg., ${project.version} ). None of these currently work.

      To demonstrate:

      mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.0-alpha-4 -DgroupId=ca.ucalgary.tlc -DartifactId=my-webapp

      And then add this to the pom.xml:

      <build>
      <plugins>
      <plugin>
      <artifactId>maven-war-plugin</artifactId>
      <configuration>
      <webResources>
      <resource>
      <filtering>true</filtering>
      <directory>${basedir}/src/main/webapp</directory>
      <includes>
      <include>*/.xml</include>
      </includes>
      </resource>
      </webResources>
      </configuration>
      </plugin>
      </plugins>
      </build>

      And finally change the web.xml produced by the archetype so there is something to filter:

      <web-app>
      <display-name>${project.name}</display-name>
      </web-app>

      Now 'mvn package' and note that target/my-webapp-1.0-SNAPSHOT/WEB-INF/web.xml is not filtered.

      If you add:

      <filters>
      <filter>src/main/filters/build.dev.properties</filter>
      </filters>

      to the build element, and add the build.dev.properties, and specify the project.name property, you do get successful filtering.

      Attachments

        1. my-webapp.zip
          4 kB
          Julian Wood

        Issue Links

          Activity

            People

              brett Brett Porter
              woodj Julian Wood
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.5h Original Estimate - 0.5h
                  0.5h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.75h
                  0.75h