Tomcat maven plugin example

Tomcat maven plugin example

Well to add and configure tomcat plugin to pom.xml and use it deploy the web application without any tomcat installation in machine.

It is very useful when you want to test your application in developer’s machines where actual tomcat installation is not available due to any reason.

Edit project’s pom.xml file and plugin entry inside build tag

Tomcat maven plugin configuration

You can add the tomcat plugin in various ways within configuration tag. Some useful configuration options are:

  • address – This IP address will be used on all ports
  • contextFile – The path of the Tomcat context XML file.
  • hostName – configure host name
  • httpsPort – The https port to run the Tomcat server on.
  • keystoreFile – Override the default keystoreFile for the HTTPS connector (if enabled)
  • keystorePass – Override the default keystorePass for the HTTPS connector (if enabled)
  • mainClass – Main class to use for starting the standalone jar.
  • systemProperties – List of System properties to pass to the Tomcat Server.
  • port – Custom port number
  • path – The webapp context path to use for the web application
  • warFile – The path of the WAR file to deploy.

To run the application with tomcat maven plugin, use maven goal as

mvn tomcat7:run

When you run above maven goal, you can see tomcat starting in console log with default port 8080



要查看或添加评论,请登录

?? Saral Saxena ???????的更多文章

社区洞察

其他会员也浏览了