I'm using Spring Boot and Gradle to create a war.
war {
baseName = 'foo'
version = '0.1.0'
}
As the war task has a version number the generated war name is foo-0.1.0.war and so when deployed to Tomcat the context path is http://localhost/foo-0.1.0/
I'd like to use the context path 'bar' omitting the version number and using a different path.
http://localhost/bar
Is this possible using a Spring annotation? I've tried changing the @RequestMapping but this only changes the context to http://localhost/foo-0.1.0/bar
Following the answers here and here tried adding a context xml snippet to <catalina_home>/conf/Catalina/localhost/
<Context docBase="/foo-0.1.0" path="/bar" reloadable="true"> </Context>
but although Tomcat is be undeploying /foo-0.1.0 I get the error:
WARNING: A docBase C:\tools\apache-tomcat-7.0.53\webapps\foo-0.1.0 inside the host appBase has been specified, and will be ignored.
Have I configured the Context incorrectly?
If setting the context is the correct solution how do I add it to my project as spring boot appears to generate the web-inf folder when the application is compiled?
I've tried adding context.xml to /src/main/webapp/META-INF and although its included in the war it doesn't change the context path


server.context-path=/barin yourapplication.properties. - M. Deinum\conf\Catalina\localhost- GrahamAThis attribute must only be used when statically defining a Context in server.xml. In all other circumstances, the path will be inferred from the filenames used for either the .xml context file or the docBase.(from the tomcat guide). So the only solutions appears to be to rename your war or add it inside the Host element in your server.xml. - M. Deinum