Conventionally, a Servlet Maven project is deployed to Tomcat production server by deploying a generated war to the - webapps - directory of Tomcat. However, Spring-Boot, as a practical trend, recommends jar
over war
. This preference has no problem for testing, but in case of deployment to an existing Tomcat server in Production, AFAIK, only a war is accepted. So my solution would be:
packaging
element as war
as such: <packaging>war</packaging>
. But this is manifestly an extra stepQuestion: Are the solutions above OK? or are there any other better solutions of deployment to production? In case of the third solution, there is only Tomcat7 Maven plugin according to my knowledge, what if I only want to test with Tomcat 8 or Tomcat 9? I tried to use a main class to start up an embedded Tomcat, but it is superb difficult to deal with the dependencies