简体   繁体   English

使用tomcat-maven-plugin将单个war部署到多个tomcats

[英]Deploy a single war to multiple tomcats using tomcat-maven-plugin

I'm trying to deploy a single war project to multiple tomcats using mvn tomcat:deploy . 我正在尝试使用mvn tomcat:deploy单个war项目部署到多个tomcats。 Since these are listener project (aka workers), their overlapping names are irrelevant. 由于这些是听众项目(又名工人),因此它们的重叠名称无关紧要。 When I have 当我有

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <configuration>
        <url>`http://192.168.116.54:8080/`manager/text</url>
        <server>standaardTomcat</server>
        <path>/picalcworker</path>
    </configuration>
</plugin>

a single war will be deployed on that server. 将在该服务器上部署单个战争。 Though I cannot have multiple 'plugins' of the same groupId artifactId combination, so simply copy this and change the url will result in a warning and only one (the latest) to be deployed. 虽然我不能拥有相同groupId artifactId组合的多个“插件”,但只需复制它并更改url将导致警告并且只部署一个(最新的)。
This plugin further seems to allow: 这个插件似乎进一步允许:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
        <execution>
        <id>1</id>
        <phase>deploy</phase>
            <goals>
                <goal>deploy</goal>
            </goals>
            <configuration>
                <url>http://192.168.116.52:8080/manager/text</url>
                <server>standaardTomcat</server>
                <path>/picalcworker</path>
            </configuration>
        </execution>
        <execution>
        <id>2</id>
        <phase>deploy</phase>
            <goals>
                <goal>deploy</goal>
            </goals>
            <configuration>
                <url>http://192.168.116.53:8080/manager/text</url>
                <server>standaardTomcat</server>
                <path>/picalcworker</path>
            </configuration>
        </execution>
    </executions>
</plugin>

but then mvn tomcat:deploy will try to deploy to localhost , since <configuration><url> was empty in this plugin's root (but I cannot supply a singular url there, since I need multiple). 但是mvn tomcat:deploy会尝试部署到localhost ,因为<configuration><url>在这个插件的根目录中是空的(但我不能在那里提供一个单独的url,因为我需要多个)。 Also possible tomcat7 and tomcat6. 也可能是tomcat7和tomcat6。 I really like the deploy and undeploy options. 我非常喜欢deploy和undeploy选项。 Does anybody know how to make this work, or some reasonable alternative? 有人知道如何使这项工作,或一些合理的替代方案?

currently not possible. 目前不可能。 Note the plugin is now hosted at Apache see http://tomcat.apache.org/maven-plugin.html . 请注意,插件现在在Apache上托管,请参阅http://tomcat.apache.org/maven-plugin.html Can you load a jira for that ? 你可以加载一个jira吗? That need a bit of code (maybe you can add a patch :-) ) 这需要一些代码(也许你可以添加一个补丁:-))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM