How to embed Tomcat server in Maven application

  This example  is   a basic   web  application  to  embed   Tomcat server  in you Maven
 application. Basically   use  of  tomcat plug in  in your  application . Tomcat7  plugin2.2 
 and  higher version can  be use for this .   Here   i    have application   StartWeb

                   1.  Create  Maven  Project  StartWeb .

                   2.    configure   pom.xml.

                  3.     Download Maven  setpath  and run mvn

                  5.    web.xml  file  configure
                   6.    create   you jsp page  or html page

                  7.   clean  and  install  , build  the project

                  8,  Start  tomcat

                  9, Run  your application .


       Pom  file    will look   something  like this .  This   is  StartWeb  pom.xml.

  folder  structure

  you can   use  java 7 lib  if get compilation problem.

    <project xmlns="" xmlns:xsi=""


       <!-- Servlet Library -->





  So   need   to  configure   web.xml .  This  needed  when your   create   web  using jsp , servlets ets

   you can use   simplest   formate  also  for this application.

<web-app xmlns=""




<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title> Startweb</title>


           <a><b>Welcome User!!!!</b></a>


 Maven  run  tomcat

 Run status 

Running  application

Shutdown   server

 For mac   simply ctr+c   then   type command in terminal  $ mvn   tomcat:shutdown      it  give build

  Or  eclipse  go ---> run --> run confuguration -->  then in goal   tomcat:shutdown similarly you can start too.

How to embed Tomcat server in Maven application How to embed  Tomcat server in  Maven  application Reviewed by Mukesh Jha on 12:48 AM Rating: 5


Add your comment

All Right Reserved To Mukesh Jha.. Theme images by Jason Morrow. Powered by Blogger.