I'm trying to deploy my application on 2 different glassfish domains on the same server. One is called localhost-domain1, second is localhost-domain2. All my deploys go into localhost-domain1(but at least those deploy successfully).
To setup it I made 2 profiles in my 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>
Then I deploy with desired profile, yet both profiles deploy into localhost-domain1.
The problem was with cargo.remote.port. It should actually be cargo.glassfish.admin.port. Changing name of that property fixed everything.