Building the WAR with m2eclipse in combination with WTP (handling webResources)

Posted by waxwing on Stack Overflow See other posts from Stack Overflow or by waxwing
Published on 2010-05-18T09:41:40Z Indexed on 2010/05/18 10:30 UTC
Read the original article Hit count: 457

Filed under:
|
|
|
|

I have a situation where I have a web application that is built using maven (i.e., maven-war-plugin). For each code modification, we have had to manually launch maven and restart the application server. Now, to reduce build cycle overhead, I want to use WTP to publish the webapp.

Now, we have resource processing with Maven, and there are some additional Maven tasks defined in our POM when building the webapp. Therefore m2eclipse seems like a natural solution.

I have gotten far enough that the Maven builder is running these tasks and filtering resources correctly. However, when I choose "Run on Server", the WAR file does not look like it would if I built it in Maven.

I am guessing that this is because WTP actually builds the WAR, and not the m2eclipse builder. So even though we have configured the maven-war-plugin in our POM, those settings are not used.

Below is a snippet with our maven-war-plugin configuration. What is configured under "webResources" is not picked up, it appears:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
 <outputDirectory>${project.build.directory}</outputDirectory>
 <workDirectory>${project.build.directory}/work</workDirectory>
 <webappDirectory>${project.build.webappDirectory}</webappDirectory>
 <cacheFile>${project.build.webappDirectory}/webapp-cache.xml</cacheFile>
 <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
 <nonFilteredFileExtensions>
  <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
  <nonFilteredFileExtension>png</nonFilteredFileExtension>
  <nonFilteredFileExtension>gif</nonFilteredFileExtension>
  <nonFilteredFileExtension>jsp</nonFilteredFileExtension>
 </nonFilteredFileExtensions>
 <webResources>
 <!-- Add generated WSDL:s and XSD:s for the web service api. -->
   <resource>
   <directory>${project.build.directory}/jaxws/wsgen/wsdl</directory>
   <targetPath>WEB-INF/wsdl</targetPath>
   <filtering>false</filtering> 
   <includes>
     <include>**/*</include>
   </includes>
 </resource>               
 </webResources>
 </configuration>

Do I need to reconfigure these resources to be handled elsewhere, or is there a better solution?

© Stack Overflow or respective owner

Related posts about m2eclipse

Related posts about wtp