让Maven进行到Tomcat的并行部署

让Maven进行到Tomcat的并行部署

本文介绍了让Maven进行到Tomcat的并行部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到让Maven进行利用Tomcat 7并行部署的Tomcat 7部署的标准化方法:

I can't find a standardised way of getting Maven to do Tomcat 7 deployments that make use of Tomcat 7's parallel deployments:

http://tomcat.apache.org/tomcat- 7.0-doc/config/context.html#Parallel_deployment

是否有可靠的方法来做到这一点?也许总是保持该应用程序的两个版本正常运行?

Is there a solid way to do this? Maybe always keeping two versions of the app live?

推荐答案

您可以使用 tomcat7-maven-plugin :

        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <path>/WebappName##${maven.build.timestamp}</path>
                <url>http://localhost:8080/manager/text</url>
                <username>tomcat</username>
                <password>tomcat</password>
                <update>true</update>
            </configuration>
        </plugin>

如您所见,根据本示例中的构建时间戳记,在path元素中指定了版本.

As you can see the version is specified in the path element, based on the build timestamp in this example.

当然,如果您不想让所有旧版本都运行,则仍然需要在server.xml <Host>元素中使用undeployOldVersions="true".

Of course, you still need to use undeployOldVersions="true" in your server.xml <Host> element if you do not want to keep all the older version running.

这篇关于让Maven进行到Tomcat的并行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 18:27