Web app version in Tomcat Manager

24,677

Solution 1

The version is the one specified when deploying the application through the manager.

See the documentation:

tag: Specifying a tag name, this allows associating the deployed webapp with a version number. The application version can be later redeployed when needed using only the tag.

Also, you can deploy multiple versions of the same war by adding the version after ## (e.g. myApp##1.0.war, myApp##1.1.war). The manager will show this version in the overview.

Solution 2

With maven set the output war file name:

...
<artifactId>MyTest</artifactId>
<version>0.0.1</version>
...
<build>
    <finalName>${project.artifactId}##${project.version}</finalName>
</build>
...

Output -> MyTest##0.0.1.war

Or simple rename war-file with format file_name##version.war ;)

Solution 3

For maven, use the tomcat plugin configuration path :

<project>
    ...
    <build>
        ...
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <path>/${project.artifactId}##${project.version}</path>
                </configuration>
            </plugin>
        </plugins>
        ...
    </build>
    ...
</project>

finalName trick didn't worked for me.

Solution 4

  • In my case, myapp#v0.2.1 notation does not work.
  • I tried the tag parameter, not work too.. (call with maven)

Referred to Apache Documentation, I tried to deploy war file manually and it works.

I do not understand why it does not work with maven tomcat deploy

Configuration : Simple Java EE/restlet app with Tomcat 7 / Java 7 / Maven 4 

Solution 5

I am running Tomcat 8.0.30 and to add a version in Tomcat Web Application Manager one can simply rename MyApp (under webapps folder) to MyApp##1.0.2 without creating .war file.

If you want to create .war file, follow these steps:

  • Navigate to Tomcat webapps folder, on the address bar type cmd or cmd.exe or else you can open cmd and navigate to your tomcat webapps directory

enter image description here

  • Enter this cmd - jar cvf MyApp.war .

Here MyApp is name of Application, .war is the extension for creating war file (also called as Web Application Archive) and . represents current directory where war file will be created..

After doing this, you'll see MyApp.war file under webapps. Now just rename to MyApp##1.0.2.war and the server will automatically reload the context with name.

enter image description here

That's it!

Share:
24,677

Related videos on Youtube

John in MD
Author by

John in MD

Programming in Scala and Java mostly.

Updated on August 09, 2020

Comments

  • John in MD
    John in MD almost 4 years

    How can I configure my web application for deployment in Tomcat so that Tomcat Manager shows the version in the table that lists all applications installed (/manager/html/list)?

    Currently it shows "None Specified" for all apps, including itself. I am using Tomcat 7.0.11.

    • Bozho
      Bozho almost 13 years
      How do you want to specify the version? Which tomcat are you using?
    • John in MD
      John in MD almost 13 years
      I'm using Tomcat 7.0.11.
    • Bozho
      Bozho almost 13 years
      So you imply the ##X version? Isn't that shown as different context/app?
    • John in MD
      John in MD almost 13 years
      I don't know what you mean by ##X ?
    • Bozho
      Bozho almost 13 years
      sorry, my bad, it's not about that version
    • John in MD
      John in MD almost 13 years
      Actually I think you were on the right track. I tried the naming the war myapp#002.war and copying it into the webapps directory but Tomcat rejected the war complaining it had an invalid name. I'm looking at tomcat.apache.org/tomcat-7.0-doc/config/context.html#Naming.
  • John in MD
    John in MD almost 13 years
    I tried this but the version in Tomcat Manager is still "None Specified".
  • Bozho
    Bozho almost 13 years
    which? the ##? IF so, then only the first part of my answer is what you are looking for.
  • John in MD
    John in MD almost 13 years
    Putting <version>1.0</version> in the web.xml did not work. Naming the war file myapp##002.war did. Thanks.
  • Joeri Hendrickx
    Joeri Hendrickx over 10 years
    that's because you need to use double hash. myapp##v0.2.1 should work.
  • Silviu Burcea
    Silviu Burcea over 10 years
    Wait what? Maven 4? I wanna try it too!
  • Damien C
    Damien C over 10 years
    I tried double Hash, and it works. With Maven tricks, I succeeded in building and deploying it with tomcat manager perfectly
  • Christopher Schultz
    Christopher Schultz about 9 years
    Note that the version number requires two hashes, like this: myApp##1.1.war. Using a single hash will change the deployment path to myApp/1.1/ which is probably not what you want.
  • Sagar Mhatre
    Sagar Mhatre over 8 years
    I used Tomcat 8.0.28, tried with the <tag> in pom.xml, as well as with the ##, but it didn't work. I can see that maven prints in the console localhost:8028/manager/text/…. But it does not show up in the Version column. At last we decided adding the version number in the <display-name>Application v1.1</display-name> tag itself so that it gets displayed in the display Name column itself
  • Eugene Gr. Philippov
    Eugene Gr. Philippov over 4 years
    New documentation (Tomcat 7.0.96) does not mention this. tomcat.apache.org/tomcat-7.0-doc/…
  • Eugene Gr. Philippov
    Eugene Gr. Philippov over 4 years
    At web.xml: <web-app blahblah><display-name>sometext</display-name>…
  • typekcz
    typekcz over 3 years
    This is it for the automatic deploy process. You are the real MVP.