在用maven的tomcat:run之类的来跑web项目时,会有个根目录问题。
比如项目ABC,那么根目录默认就是在localhost/ABC。
处理方法之一就是 tomcat7-maven-plugin: http://tomcat.apache.org/maven-plugin-2.0/tomcat7-maven-plugin/usage.html
类似这样配置
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<path>/mycontext</path>
</configuration>
</plugin>
path就是地址的配置,默认值是/${project.artifactId}。
除此之外就是要在run的时候是 tomcat7:run 而不是 tomcat:run。
