1

私が取り組んでいるこのプロジェクトでは、いくつかのモジュール (ドメイン、dao、サービス、戦争) を定義する大きなマスター pom ファイルがあります。

Cargo を使用して、自分の war をリモートの tomcat サーバーにデプロイしたいと考えています。

ただし、 mvn cargo:deploy -Ptest を実行すると、モジュール dao 内のモジュール ドメインの依存関係を解決できないというエラーが表示されます。

貨物構成を戦争ポンに入れてみましたが、それでも同じです。

誰かが私を助けることができますか?

これは親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>

これは 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>

ご覧のとおり、戦争はサービスに依存しており、それ自体は dao に依存しており、サービスはドメインに依存しています。

4

1 に答える 1

2

私の意見では、最初に mvn install を使用する必要があります。

mvn -pl product-war cargo:deploy -Ptest
于 2012-03-14T19:23:50.937 に答える