Saturday, October 25, 2014

FIX: Missing web.xml issue on Heroku when trying Spring Java Based Configuration

If you are trying to use Spring Java Based Configuration instead of web.xml and other xml configuration files on application hosted on Heroku, you might come across the following error:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project sg-compare: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]

Fix:

In your pom.xml add

  <failOnMissingWebXml>false</failOnMissingWebXml>  

to the maven-war-plugin

Example:

Replace the following code

 <plugin>  
         <artifactId>maven-war-plugin</artifactId>  
         <version>2.2</version>  
 </plugin>  


with the following:

 <plugin>  
         <artifactId>maven-war-plugin</artifactId>  
         <version>2.2</version>  
         <configuration>  
                <failOnMissingWebXml>false</failOnMissingWebXml>  
         </configuration>  
 </plugin>  

No comments:

Post a Comment