0

I'd like to deploy a war to both a Tomcat 7 and Weblogic container viacargo:deploy at the same time. As it stands I can only get one profile to be active at a time.

Here is what I currently have:

<profiles>
    <!--  *********************************************************************
                          CARGO - FOR TOMCAT.
                          Activated when file ${env.USERPROFILE}/foo.bar exists (which should be there after successful Tomcat tookit install)
              ********************************************************************* -->
    <profile>
        <id>tomcat</id>
        <activation>
            <file><exists>${env.USERPROFILE}/foo.bar</exists></file>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>${cargo-maven2-plugin.version}</version>
                    <configuration>
                        <container>
                            <containerId>tomcat7x</containerId>
                            <type>installed</type>
                            <home>${env.USERPROFILE}/foo/apache-tomcat-7.0.57</home>
                            <timeout>180000</timeout>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <home>${env.USERPROFILE}/foo/apache-tomcat-7.0.57</home>
                        </configuration>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <properties>
                                    <!--No slash needed before the context-->
                                    <context>sec-captc</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>


  <!--  *********************************************************************
                              CARGO - FOR WEBLOGIC
                    ********************************************************************* -->
    <profile>
        <id>weblogic</id>
        <activation>
            <file><exists>${env.USERPROFILE}/foo.bar</exists></file>
        </activation>
        <build><plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>${cargo-maven2-plugin.version}</version>
                <configuration>
                    <container>
                        <containerId>weblogic12x</containerId>
                        <type>installed</type>
                        <home>${installed-weblogic.home}/foo</home>
                        <timeout>180000</timeout>
                    </container>
                    <configuration>
                        <type>existing</type>
                        <home>${installed-weblogic.domain}</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <type>war</type>
                            <properties>
                                <context>/${installed-weblogic.war.contextpath}</context>
                            </properties>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins></build>
    </profile>
</profiles>

What do I need to add/change to be able to make these work concurrently?

TheLimeTrees
  • 413
  • 6
  • 20

1 Answers1

0

Are you sure only one profile is active? It might be that both are active, but the cargo-maven2-plugin plugin executions are using the same ID, and thus only one executes.

In the profiles, looks like you have configuration for each server, but no plugin executions. Try adding an execution to the cargo-maven2-plugin in the profile that isn't running. Set the execution ID to something like "deploy-tomcat". See if that helps.

Running Maven in debug mode (with -X) might help you see what's going on.

user944849
  • 14,524
  • 2
  • 61
  • 83
  • I'm rather new to maven and id wondered if it was because of that given the things I've read. I'll give that a try and see if that works. – TheLimeTrees Dec 13 '16 at 09:04