如何使用货物maven插件在两个不同的glassfish域上部署?

时间:2014-01-10 20:42:29

标签: java maven glassfish pom.xml cargo

我正在尝试在同一台服务器上的2个不同的glassfish域上部署我的应用程序。一个叫做localhost-domain1,第二个叫localhost-domain2。我的所有部署都进入了localhost-domain1(但至少那些部署成功)。

要设置它,我在POM.xml中创建了两个配置文件

<profile>
        <id>continousIntegrationA</id>
        <build>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                </resource>
                <resource>
                    <directory>src/main/webapp</directory>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.4.5</version>
                    <configuration>
                        <container>
                            <containerId>glassfish4x</containerId>
                            <type>remote</type>
                        </container>
                        <configuration>
                            <type>runtime</type>
                            <properties>
                                <cargo.hostname>*censored*</cargo.hostname>
                                <cargo.remote.username>*censored*</cargo.remote.username>
                                <cargo.remote.password>*censored*</cargo.remote.password>
                                <cargo.remote.port>4848</cargo.remote.port>
                                <cargo.glassfish.domain.name>localhost-domain1</cargo.glassfish.domain.name>
                            </properties>
                        </configuration>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <properties>
                                    <context>${project.name}</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.glassfish.deployment</groupId>
                            <artifactId>deployment-client</artifactId>
                            <version>3.2-b06</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>continousIntegrationB</id>
        <build>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                </resource>
                <resource>
                    <directory>src/main/webapp</directory>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.4.5</version>
                    <configuration>
                        <container>
                            <containerId>glassfish4x</containerId>
                            <type>remote</type>
                        </container>
                        <configuration>
                            <type>runtime</type>
                            <properties>
                                <cargo.hostname>*censored*</cargo.hostname>
                                <cargo.remote.username>*censored*</cargo.remote.username>
                                <cargo.remote.password>*censored*</cargo.remote.password>
                                <cargo.remote.port>4949</cargo.remote.port>
                                <cargo.glassfish.domain.name>localhost-domain2</cargo.glassfish.domain.name>
                            </properties>
                        </configuration>
                        <deployables>
                            <deployable>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <type>war</type>
                                <properties>
                                    <context>${project.name}</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.glassfish.deployment</groupId>
                            <artifactId>deployment-client</artifactId>
                            <version>3.2-b06</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>

然后我使用所需的配置文件进行部署,但两个配置文件都部署到localhost-domain1。

1 个答案:

答案 0 :(得分:0)

问题出在cargo.remote.port上。它应该是cargo.glassfish.admin.port。更改该属性的名称修复了所有内容。