My .war file is created with a version in it. For example: myproject-1.0.0-SNAPSHOT.war
For next version it would be second version : myproject-2.0.0-SNAPSHOT.war
and so on.
Now if I deploy to tomcat the path would change with every new version as Tomcat just takes the filename as the context path.
Of course this is not acceptable as the path should be fixed.
So I already tried to create a context.xml file in META-INF folder and set path there , but did not help.
What else could I do ?
CodePudding user response:
You can include a context version in your war's file name by using "##" as delimiter, see https://tomcat.apache.org/tomcat-9.0-doc/config/context.html#Naming
It will be stripped on deployment, leaving you with the same context path as before.
CodePudding user response:
You could rename the war file before deploying.
Or, if you're using the api from the manager app to deploy, set the path parameter
http://localhost:8080/manager/text/deploy?path=/foo
Reference: https://tomcat.apache.org/tomcat-8.5-doc/manager-howto.html