项目在开发阶段经常会修改后台Java代码,但是每次make project后都需要重启Tomcat才能是代码生效。
解决办法是修改Tomcat的conf目录下server.xml的配置文件,使reloadable=true,这样每次修改n个java文件,make的时候把这些class文件到Tomcat监听目录下,会自动提示有n个class reloaded。
以下是server.xml的修改:
<Context path="C:\Users\jonney\Desktop\wms\out\artifacts\wms_Web_exploded" debug="1" reloadable="true"/>
完全host节点:
1 <Host name="localhost" appBase="webapps" 2 unpackWARs="true" autoDeploy="true"> 3 4 <Context path="C:\Users\jonney\Desktop\wms\out\artifacts\wms_Web_exploded" debug="1" reloadable="true"/> 5 6 <!-- SingleSignOn valve, share authentication between web applications 7 Documentation at: /docs/config/valve.html --> 8 <!-- 9 <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> 10 --> 11 12 <!-- Access log processes all example. 13 Documentation at: /docs/config/valve.html 14 Note: The pattern used is equivalent to using pattern="common" --> 15 <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 16 prefix="localhost_access_log." suffix=".txt" 17 pattern="%h %l %u %t "%r" %s %b" /> 18 19 </Host>
经测试有效,使用的Tomcat版本是7
时间: 2024-11-13 08:58:49