关于tomcat的自动部署,网上很多人转帖都是用了下面的方法:
在Tomcat安装目录下,找到conf文件下的server.xml,在<Host>和</host>之间加上如下代码:
<Context path="/虚拟目录名" docBase="目标目录位置" debug="0" reloadable="true" ></Context>
但我用这种方式却出错,无奈直接看tomcat的文档。
One or more Host elements are nested inside an Engine element. Inside the Host element, you can nest Context elements for the web applications associated with this virtual host
上面的方法应该就是按照这种方式将context嵌入到了host节点中。于是去看Context的配置
Context中有这样一个属性:reloadable
reloadable | Set to |
这个属性可以在我们编译的class文件和库文件发生改变时,自动重新部署web项目,这个功能在开发时很有用但需要很大的运行开销,所以不建议在已经部署的项目上使用。但我的服务器主要是为了开发用,所以直接在Tomcat安装目录下,找到conf文件下的context.xml,修改<Context>为 <Context reloadable="true">