一、修改tomcat的server.xml文件:

   1、eclipse的Servers项目,修改server.xml,或者找到tomcat目录下的 \conf路径下的server.xml文件;

   2、找到下面的</Host>节点,在上面一行加上

           <Context path="/" reloadable="false" docBase="项目名(webapps下)"/>

           或者

           <Context path="/" docBase="项目绝对路径" reloadable="false" />

二、修改pom文件:

               <plugin>
                  <groupId>org.apache.tomcat.maven</groupId>
                  <artifactId>tomcat7-maven-plugin</artifactId>
                   <version>2.2</version>
                    <configuration>
                       <port>8080</port>
                        <path>/</path>
                   </configuration>
               </plugin>

三、项目右击——》Run Configuration ——》maven build ——》 New_configuration

     Base directory:填上项目路径;

     Goals: 填上tomcat:run -Dmaven.tomcat.uriEncoding=UTF-8 -Dmaven.tomcat.path=/ -Dmaven.tomcat.port=8080

eclipse+maven+tomcat不带项目名启动

相关文章:

  • 2021-10-27
  • 2021-07-07
  • 2021-12-22
  • 2021-07-19
  • 2021-05-28
  • 2021-04-23
  • 2022-02-03
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2021-06-15
  • 2022-01-05
  • 2021-05-03
  • 2021-04-19
相关资源
相似解决方案