Deploying a web application on two Tomcat servers on different machines with a different operating system

advertisements

I would like deploy my webapp both on Windows Tomcat 7 and Unix Tomcat 7 one after another or at the same time, if possible. Currently, I am able to successfully deploy my webapp on Windows Tomcat using tomcat-maven-plugin and calling mvn tomcat7:redeploy. But the limitation is that I have to change my pom so that it points to Unix Tomcat if I want to deploy the webapp on Unix which is very painful. Any ideas on how this can be accomplished ? Please guide.

pom.xml

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <url>http://localhost:8080/manager/text</url>
        <server>win-tomcat</server>
        <path>/${project.artifactId}</path>
    </configuration>
</plugin>

.m2/settings.xml

<settings>
    <servers>
        <server>
            <id>unix-tomcat</id>
            <username>manager</username>
            <password>manager</password>
        </server>
        <server>
            <id>win-tomcat</id>
            <username>manager</username>
            <password>manager</password>
        </server>
    </servers>
</settings>


You can do it with creating two separate build profiles one for each machine and execute build against both profile one after another