Thursday, June 6, 2019

Generating War file from Eclipse

  • In pom.xml from overview tab select packaging as war.
  • Next we need to add plugin to POM.xml
    • Right click on Pom.xml or Project =>select Maven=>select Add Plugin
    • Search for "maven-war-plugin" and add that plugin to pom.xml
  • Next if you don't have a web.xml file in your project to deploy i.e. it has been bootstrapped via java base classes add the following configuration
    •      <configuration>  
                 <failOnMissingWebXml>false</failOnMissingWebXml>  
           </configuration>
  • Right click on project and select Run as Maven Install.
Code to be added to Pom.xml
  <packaging>war</packaging>  
  <name>SpringMVCRestful</name>  
  <build>  
       <plugins>  
            <plugin>  
                 <groupId>org.apache.maven.plugins</groupId>  
                 <artifactId>maven-war-plugin</artifactId>  
                 <version>3.2.3</version>  
                  <configuration>  
                       <failOnMissingWebXml>false</failOnMissingWebXml>  
                  </configuration>  
            </plugin>  
       </plugins>  
  </build>  

*remove configuration from code if you are using web.xml for Bootstrapping

No comments:

Post a Comment

Spring Boot

What is circular/cyclic dependency in spring boot? When two services are interdependent on each other, that is to start one service, we requ...