我正在尝试将我的应用程序部署在同一服务器上的 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/