Home > database >  How to version a war file for tomcat
How to version a war file for tomcat

Time:12-18

I want to version the war file in tomcat. The name of the war file should be as follow: main-1.0.0.war, and it should be deployed as .../webapps/main. In order to achive this, I changed the "HOST" tag in server.xml. I added "<Context path..." in between the HOST tag

But when Tomcat starts now, it creates two directories. "main" and "main-1", and two tomcat instances are started. How can I prevent Tomcat creating main-1 ?

<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">  
    <Context path="/main" docBase="/main-1" debug="0" reloadable="true"></Context>
</Host>

CodePudding user response:

Simply don't deploy your WAR file to the webapps directory. As you're using a context specific configuration, your docbase can be anywhere, and you can configure an absolute path to your WAR file.

  • Anything that's found in the webapps directory is automatically deployed.
  • Anything that's configured explicitly is also deployed.

Eliminate one of these conditions, and you're left with the other.

  • Related