tomcat7默认的程序发布路径为tomcat/webapps/ROOT/下面
修改Tomcat配置文件server.xml
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host>
在host标签中间加入如下标签( docBase:填写自定义项目路径 )
<Context path="" docBase="example" debug="0" reloadable="true" />
结果如下:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
<Context path="" docBase="example" debug="0" reloadable="true" />
</Host>