java - 如何使用 Cargo Maven 插件部署在两个不同的 glassfish 域上?

标签 java maven glassfish pom.xml cargo

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

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

<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 中。

最佳答案

问题出在cargo.remote.port上。它实际上应该是cargo.glassfish.admin.port。更改该属性的名称解决了所有问题。

关于java - 如何使用 Cargo Maven 插件部署在两个不同的 glassfish 域上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21054036/

相关文章:

jakarta-ee - $Proxy$_$$_Weld$EnterpriseProxy$ 代理子类是如何实现的?

java - 这个 Hibernate/Spring 应用程序(独立)有什么问题?

java - spring hibernate配置默认使用resource_local还是jta?

maven - 更新 Maven 多模块项目中的版本

eclipse - Ear-javaee6 原型(prototype)不允许 Java 文件

java - 在 Glassfish 服务器应用程序中重新启动后,类无法转换为同一类

java - 字符串在 java 中成为对象的必要性是什么

java - 如何使用 ProcessBuilder 执行 shell 重定向(命令 > output.txt)?

java - 未找到命令 'web mvc all --package ~.web'

java - GlassFish 服务器问题