Web app version in Tomcat Manager

前端 未结 5 1241
猫巷女王i
猫巷女王i 2020-12-13 17:55

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/li

相关标签:
5条回答
  • 2020-12-13 17:58

    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.

    0 讨论(0)
  • 2020-12-13 18:03

    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 ;)

    0 讨论(0)
  • 2020-12-13 18:08

    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.

    0 讨论(0)
  • 2020-12-13 18:11
    • 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 
    
    0 讨论(0)
  • 2020-12-13 18:17

    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 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.

    That's it!

    0 讨论(0)
提交回复
热议问题