How to deploy a specific child project with a load: start using maven

I have a developed application, and I'm just trying to simplify the build process. The POM file for the parent is as follows:

<parent>
    <groupId>com.shc.obu.ca</groupId>
    <artifactId>shcobuca-pom</artifactId>
    <version>1.1.0</version>   </parent>

  <groupId>com.shc.obu.ca.osol</groupId> <artifactId>apps-pom</artifactId>   <version>${currVersion}</version>   <packaging>pom</packaging>   <name>Outlet Apps</name>

  <scm>
    <connection>scm:svn:https://ushofsvpsvn2.intra.searshc.com/svn/outlet/outlet/trunk/apps</connection>
    <developerConnection>scm:svn:https://ushofsvpsvn2.intra.searshc.com/svn/outlet/outlet/trunk/apps</developerConnection> </scm>
    <profiles>
    <profile> <id>www</id>
      <activation> <activeByDefault>true</activeByDefault> </activation>
      <modules>
        <module>www</module>
        <module>modules</module> 
      </modules>
    </profile>
    <profile> 
      <id>mts</id>
      <activation> <activeByDefault>true</activeByDefault> </activation>
      <modules>
        <module>mts</module> 
        <module>modules</module> 
      </modules>
    </profile>
    <profile> <id>search</id>
      <activation> <activeByDefault>true</activeByDefault> </activation>
      <modules>
        <module>modules</module> 
        <module>search</module> 
      </modules>
    </profile>   </profiles>

  <repositories>
    <repository>
      <id>obu.ca.repo.release</id>
      <snapshots><enabled>false</enabled></snapshots>
      <url>http://maven.cal.intra.sears.com/release</url>
    </repository>
    <repository>
      <id>obu.ca.repo.snapshot</id>
      <releases><enabled>false</enabled></releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>interval:5</updatePolicy>
      </snapshots>
      <url>http://maven.cal.intra.sears.com/snapshot</url>
    </repository>   </repositories>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <env>trunk</env>
    <currVersion>1.2.0</currVersion>   </properties>   </project>

This file shows that it has three profiles, which are basically an independent child project. I am adding a plugin to this file as shown below:

<build>
  <plugins>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <container>
              <containerId>tomcat6x</containerId>
              <home>
                  C:\tools\apache-tomcat-6.0.26
              </home>
          </container>
          <configuration>
              <properties>
                  <cargo.servlet.port>
                      8082
                  </cargo.servlet.port>
                  <cargo.jvmargs>
                      "-Xdebug" "-Xrunjdwp:transport=dt_socket,address=4646,server=y,suspend=n"
                  </cargo.jvmargs>
              </properties>
          </configuration>     
        </configuration>  
      </plugin>
  </plugins>
  </build>

But when I run "mvn cargo: start", the tomcat instance works fine, but none of the child applications are deployed. Is there a way that I can create my first child application (www) (which generates a war file called www-webapp-1.2.0.war) that is automatically deployed?

Update: Thanks Pascal. I tried to change the assembly tag as shown below:

<build>
  <plugins>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <container>
              <containerId>tomcat6x</containerId>
              <home>
                  C:\tools\apache-tomcat-6.0.26
              </home>
          </container>
          <configuration>
              <properties>
                  <cargo.servlet.port>
                      8082
                  </cargo.servlet.port>
                  <cargo.jvmargs>
                      "-Xdebug" "-Xrunjdwp:transport=dt_socket,address=4646,server=y,suspend=n"
                  </cargo.jvmargs>
              </properties>              
              <deployables> 
                <deployable> 
                  <groupId>com.shc.obu.ca.osol</groupId> 
                  <artifactId>www-webapp-1.2.0</artifactId> 
                  <type>war</type> 
                  <properties> 
                    <context>acontext</context> 
                  </properties> 
                </deployable> 
              </deployables>               
          </configuration>    
        </configuration>  
      </plugin>
  </plugins>
  </build>

. , :

[com.shc.obu.ca.osol: www-webapp-1.2.0: war] . "www-webapp" "www" , .

, , : " "

+3
2

www <deployable>. Maven2:

- , ejb, ,

packaing pom, .

:

  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.0</version>
    <configuration>
      <container>
        <containerId>tomcat6x</containerId>
        <home>C:\tools\apache-tomcat-6.0.26</home>
      </container>
      <configuration>
        <properties>
          <cargo.servlet.port>8082</cargo.servlet.port>
          <cargo.jvmargs>
              "-Xdebug" "-Xrunjdwp:transport=dt_socket,address=4646,server=y,suspend=n"
          </cargo.jvmargs>
        </properties>
        <deployables>
          <!-- application to deploy -->
          <deployable>
            <groupId>com.acme</groupId>
            <artifactId>mywebapp</artifactId>
            <type>war</type>
            <properties>
              <context>acontext</context>
            </properties>
          </deployable>
        </deployables>
      </configuration>     
    </configuration>  
  </plugin>

Update:

(...)

[com.shc.obu.ca.osol: www-webapp-1.2.0: war] . "www-webapp" "www" , .

, , Cargo , deployable , Cargo.

, , : " "

. , ( , , ).

, www ( , ) www .

+2

, Cargo. , . mvn cargo:run , .

==================== PARENT 1 =========================

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.blah.test</groupId>
    <artifactId>blah-service</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>blah-service-module1</module>
        <module>blah-service-module2</module>
        <module>blah-service-module3</module>
    </modules>
</project>

==================== MODULE 1 =========================

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.blah.test</groupId>
        <artifactId>blah-service</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>blah-service-module1</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
</project>

==================== MODULE 2 =========================

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.blah.test</groupId>
        <artifactId>blah-service</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>blah-service-module2</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
</project>

========== MODULE 3: the one which deploys all three with cargo =========================

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.blah.test</groupId>
        <artifactId>blah-service</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <artifactId>blah-service-module3</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.blah.test</groupId>
            <artifactId>blah-service-module1</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
        <dependency>
            <groupId>com.blah.test</groupId>
            <artifactId>blah-service-module2</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.6</version>
                <configuration>
                    <container>
                        <containerId>jetty6x</containerId>
                        <type>embedded</type>
                    </container>
                    <deployables>
                        <deployable>
                            <groupId>com.blah.test</groupId>
                            <artifactId>blah-service-module1</artifactId>
                            <type>war</type>
                            <properties>
                                <context>api/blah/module1</context>
                            </properties>
                        </deployable>
                        <deployable>
                            <groupId>com.blah.test</groupId>
                            <artifactId>blah-service-module2</artifactId>
                            <type>war</type>
                            <properties>
                                <context>api/blah/module2</context>
                            </properties>
                        </deployable>
                        <deployable>
                            <groupId>com.blah.test</groupId>
                            <artifactId>blah-service-module3</artifactId>
                            <type>war</type>
                            <properties>
                                <context>api/blah/module3</context>
                            </properties>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
+1

Source: https://habr.com/ru/post/1753155/


All Articles