Skip to content
𝓒π“ͺ𝓼𝓽𝓻𝓲𝓳π“ͺ

Share the knowledge

𝓒π“ͺ𝓼𝓽𝓻𝓲𝓳π“ͺ

Share the knowledge

Maven Web Project – Deploy using embedded tomcat server

Posted on August 16, 2016September 25, 2021 By sastrija

Maven provides support for running web applications in embedded tomcat server.

Use the following steps to configure local tomcat server and run it using maven command:

  1. Add maven dependency for tomcat embedded plugin to web project
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  ...
  <dependencies> ... </dependencies>
  <build>
    <finalName>sampleproject-web</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <port>8080</port>
          <path>/</path>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

2. Use following maven command to run the application in embedded tomcat server

mvn tomcat7:run
tomcat7:run -Dstarttomcat -Dtomcat.httpPort=9080

Related

Uncategorized

Post navigation

Previous post
Next post
©2026 𝓒π“ͺ𝓼𝓽𝓻𝓲𝓳π“ͺ | WordPress Theme by SuperbThemes