2

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(i.e. catalina.base) and deploy path is set as my workspace in eclipse IDE, in the server view.

Community
  • 1
  • 1
gautam
  • 197
  • 1
  • 4
  • 17

1 Answers1

0

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> 
Community
  • 1
  • 1
Pankaj Verma
  • 191
  • 10
  • I tried the things suggested by you. Basically I changed the artifactId from my project name to ROOT and the build tag is structured like: ${project.artifactId} ${project.basedir}/src/main/resources – gautam Apr 22 '16 at 06:42
  • The build tag also consists of several plugins, one of them is: org.apache.maven.plugins maven-war-plugin ${maven-war-plugin.version} ${project.version}-${BUILD_NUMBER} ${build.timestamp} – gautam Apr 22 '16 at 06:47
  • And most importantly, the workspace having the deployment directory with path, PerforceOSSPrivate\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps contains two folders namely, projectName(Containing META-INF & WEB-INF) and ROOT(Containing WEB-INF). – gautam Apr 22 '16 at 06:49
  • Do you mean........ org.apache.tomcat.maven tomcat7-maven-plugin ${tomcat7-maven-plugin.version} 8080 / ???? – gautam Apr 22 '16 at 06:54
  • here inside the remove and add url, server and update(optional) tag as specified in the answer. /${project.build.finalName} – Pankaj Verma Apr 22 '16 at 07:17
  • Thanks for your time, but nothing seems to work ! I checked server.xml in conf directory.... and it is having – gautam Apr 22 '16 at 07:30
  • with the above settings of maven. You can directly deploy the application to tomcat server with "deploy" goal. I.e. mvn tomcat7:deploy (in case you are using cmd/terminal). BTW what the error(description, message or screenshot / log trace would help) are you getting ? – Pankaj Verma Apr 22 '16 at 08:36