1

In this project I'm working on, I have a big master pom file defining several modules (domain, dao, service, war).

I want to deploy my war to my remote tomcat server using Cargo.

running mvn cargo:deploy -Ptest however gives me an error that the dependency for the module domain in the module dao could not be resolved.

I've tried putting the cargo config in the war pom but still the same.

Can someone help me?

This is the parent POM

<?xml version="1.0" encoding="UTF-8"?>
<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.domain</groupId>
    <artifactId>product</artifactId>
    <version>1.2-SNAPSHOT</version>
    <packaging>pom</packaging>

    <dependencyManagement>
        <dependencies>
            <!-- Internal dependencies -->
            <dependency>
                <groupId>com.domain.product</groupId>
                <artifactId>product-domain</artifactId>
                <version>${project.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.domain.product.dao</groupId>
                <artifactId>product-dao-api</artifactId>
                <version>${project.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.domain.product.dao</groupId>
                <artifactId>product-dao-jpa2</artifactId>
                <version>${project.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.domain.product.service</groupId>
                <artifactId>product-service-api</artifactId>
                <version>${project.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.domain.product.service</groupId>
                <artifactId>product-service-impl</artifactId>
                <version>${project.version}</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>com.domain.product</groupId>
                <artifactId>product-war</artifactId>
                <version>${project.version}</version>
                <type>jar</type>
                <type>war</type>
                <scope>compile</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.2.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <!-- profiles -->
    <profiles>
        <profile>
            <id>test</id>
            <activation>
            <property>
                <name>environment.type</name>
                <value>test</value>
            </property>
            </activation>
            <properties>
            </properties>
        </profile>
    </profiles>

    <modules>
        <module>product-domain</module>
        <module>product-dao-api</module>
        <module>product-dao-jpa2</module>
        <module>product-service-api</module>
        <module>product-service-impl</module>
        <module>product-war</module>
    </modules>
</project>

This is the WAR POM:

<?xml version="1.0" encoding="UTF-8"?>
<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>
        <artifactId>product</artifactId>
        <groupId>com.domain</groupId>
        <version>1.2-SNAPSHOT</version>
    </parent>
    <groupId>com.domain.product</groupId>
    <artifactId>product-war</artifactId>
    <name>product</name>
    <packaging>war</packaging>

    <dependencies>
        <dependency>
            <groupId>com.domain.product.service</groupId>
            <artifactId>product-service-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>com.domain.product.service</groupId>
            <artifactId>product-service-api</artifactId>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>test</id>
            <activation>
                <property>
                    <name>environment.type</name>
                    <value>test</value>
                </property>
            </activation>
            <properties>
                <!-- Deployment settings -->
                <cargo.containerId>tomcat7x</cargo.containerId>
                <cargo.baseurl>http://test.domain.net:8080</cargo.baseurl>
                <container.url>${cargo.baseurl}/manager/text</container.url>
                <container.user>tomcat-txt</container.user>
                <container.password>password</container.password>
                <container.pingurl>${cargo.baseurl}/${project.name}/index.html</container.pingurl>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <configuration>
                            <wait>true</wait>
                            <container>
                                <containerId>${cargo.containerId}</containerId>
                                <type>remote</type>
                            </container>
                            <configuration>
                                <type>runtime</type>
                                <properties>
                                    <cargo.remote.uri>${container.url}</cargo.remote.uri>
                                    <cargo.remote.username>${container.user}</cargo.remote.username>
                                    <cargo.remote.password>${container.password}</cargo.remote.password>
                                </properties>
                            </configuration>
                            <deployer>
                                <deployables>
                                    <deployable>
                                        <groupId>com.domain.product</groupId>
                                        <artifactId>product-war</artifactId>
                                        <type>war</type>
                                        <properties>
                                            <context>${project.name}</context>
                                        </properties>
                                        <pingURL>${container.pingurl}</pingURL>
                                    </deployable>
                                </deployables>
                            </deployer>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

As you can see, the war is dependent from the service, which by itself is dependent from the dao and that one from the domain.

Peter Verhoye
  • 97
  • 2
  • 10

1 Answers1

2

In my opinion you have to use first a mvn install and than

mvn -pl product-war cargo:deploy -Ptest
khmarbaise
  • 92,914
  • 28
  • 189
  • 235