Maven tomcat plugin

北城以北 提交于 2019-12-13 05:13:34

问题


is it possible to run spring mvc application on tomcat(with this plugin http://mojo.codehaus.org/tomcat-maven-plugin/) if yes, where is the application log and deploy web app directory located ?

Let me rephrase the question. I'm asking for some way to start my web app(spring mvc application) from a command line, either with maven or with something inside application that creates web server.

What would you recommend? I found this tomcat maven plugin while googling, no special reason to use it

Currently I use jboss server for this application, but I want to run both server and application from application,any suggestions?


回答1:


tomcat:run runs a web application in an embedded tomcat instance ... useful for testing during development.
See http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html for listing of config parameters for the run goal, including warSourceDirectory which, if not specified defaults to ${basedir}/src/main/webapp




回答2:


I'm not sure exactly why but we use the mvn cargo:start plugin instead, for testing locally when building with maven. We also utilize Spring and haven't had any issues regarding the mix. When starting up the Tomcat container with the command above it shows the following in the console

C:\SVN\myproject-war\target\tomcat6x\home>

This contains the webapps folder where the war is deployed and a logs folder.

Hope this helps, sorry I don't have direct experience with the tomcat-maven-plugin itself.




回答3:


If I understand your question correctly, from your application you want to start tomcat to serve a spring MVC application.

If so, you do not need maven or a maven plugin to do this. You can use tomcat catalina APIs to achieve this. Though dated, this article explains how.

As the other answers stated, maven's tomcat and cargo plugins allow you to start and stop tomcat from maven - typically to run some integration tests.



来源:https://stackoverflow.com/questions/4939036/maven-tomcat-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!