jira-importer opened a new issue, #214:
URL: https://github.com/apache/maven-war-plugin/issues/214

   **[Julian 
Wood](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=woodj)** 
opened 
**[MWAR-41](https://issues.apache.org/jira/browse/MWAR-41?redirect=false)** and 
commented
   
   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.
   
   
   ---
   
   **Affects:** 2.0.1
   
   **Attachments:**
   - 
[my-webapp.zip](https://issues.apache.org/jira/secure/attachment/12720472/my-webapp.zip)
 (_3.99 kB_)
   
   **Issue Links:**
   - [MWAR-43](https://issues.apache.org/jira/browse/MWAR-43) Web resource 
filtering does not expand variables
    (_**"is duplicated by"**_)
   
   2 votes, 2 watchers
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to