简体   繁体   中英

How to avoid appending webapp name in the url?

I went through the link deploy war file on Tomcat and run without project name and I found that the question being asked is exactly the same that I'm having.

But the answers confused me a bit. So first of all I want to know whether this can be achieved by not modifying the Tomcat installation directory at all ! If yes then please suggest me a concrete way to achieve my objective.

Also, my environment settings is like I'm building war with the help of maven. And, the server path(ie catalina.base) and deploy path is set as my workspace in eclipse IDE, in the server view.

By reading the above link deploy war file on Tomcat and run without project name

You can simply removed the other apps(from tomcat's webapps dir) and change the application's name to ROOT and deploy it to tomcat.

In case of maven project change it in your pom.xml(inside project tag) as :

<project ...>
    <groupId>UR_PKG_NAME</groupId>
    <artifactId>ROOT</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
    <finalName>ROOT</finalName>
    .
    .
    .
</project>

Also you need to provide the Url of the running tomcat server in pom.xml(inside tomcat7 plugin configuration tag) as :

<url>http://IP:PORT/manager/text</url>
<server>tomcat</server><!-- the name of server in your maven settings.xml -->
<update>True</update> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM