0

I need to do a Maven filter on a file that is located under my src/main/webapp directory. This seems straightfoward when using the maven-war-plugin:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-war-plugin</artifactId>
 <configuration>
   <webResources>
     <resource>
       <filtering>true</filtering>
       <directory>src/main/webapp</directory>
       <includes>
         <include>index.html</include>
       </includes>
     </resource>
   </webResources>
 </configuration>
</plugin>

However, I am building a JAR file that contains a webapp with an embedded web server. I cannot seem to get the maven-jar-plugin to do filtering on the contents of the webapp directory. What is the best way to do this?

Mike
  • 1,791
  • 1
  • 17
  • 23
  • Do you really mean the maven-jar-plugin or do you mean maven-war-plugin ? maven-jar-plugin does not support filtering. Than you have to go for filtering via [maven-resources-plugin](http://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html}. – khmarbaise Dec 12 '14 at 21:44

1 Answers1

0

If you do a mvn clean package does the filtering happen ? If so its just a matter of linking the filtering to the right execution phase of the embedded web server. If you are using maven tomcat plugin for e.g try running mvn tomcat7:run-war or mvn tomcat7:run

JVXR
  • 1,294
  • 1
  • 11
  • 20
  • No, `mvn clean package` doesn't trigger the filtering either. – Mike Dec 12 '14 at 19:30
  • Is the index.html directly under src/main/webapp if not try **/index.html . Also make sure that the index.html indeed has placeholders put in correctly i.e. in the ${some.property} format and you are setting the properties correctly. – JVXR Dec 12 '14 at 19:34