Maven webapp filtering for JAR

640 views Asked by At

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?

1

There are 1 answers

2
JVXR On

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