Deploy WAR file with tomcat version

I was interested to know what would be the best practice for deploying a WAR WARMAN file in Tomcat. Using the maven release plugin, I get a version file for my project for example: myservice-1.0.0.war

I would like to deploy it to tomcat so that I can access it as follows for example: http: // localhost: 8080 / myservice

By default, tomcat explodes a war file as a directory named myservice-1.0.0 under CATALINA_HOME / webapps. But I want to explode the war as a directory called myservice for the reasons mentioned above.

I know that I can just rename myservice-1.0.0.war -> myservice.war and then deploy it to Tomcat.

I wanted to know what others are doing?

+6
maven-2 tomcat
source share
4 answers

I would do this by specifying myservice as artifactId and the final name and using the maven plugin for deployment for tomcat. http://cargo.codehaus.org/Maven2+Plugin+Tips

+3
source share

You can pack the file / META -INF / context.xml with the content as follows:

<?xml version="1.0"?> <!DOCTYPE Context> <Context path="myapp"> </Context> 

See documentation at http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

+2
source share

I ran into the same problem. What worked for me is to insert this property element into the configuration for deploying the load:

  <deployable> <groupId>org.something</groupId> <artifactId>something-idm-esb</artifactId> <properties> <context>something-idm-esb</context> </properties> <type>war</type> </deployable> 

Without this property element, the application will be deployed to localhost: 8080 / something-idm-esb-0.9.14.2, which does not meet the needs of the application at runtime. In the properties section, the application is deployed to localhost: 8080 / something-idm-esb /

+1
source share

Instead of renaming the war file, you can do this:

Just add the following to your tomcat-dir / conf / server.xml file between the <Host>..<\Host> tags.

for: file myservice-1.0.0.war

 <Context path="/myservice" docBase="/myservice-1.0.0" debug="0" reloadable="true"></Context> 

Link

0
source share

All Articles