Deploying a project to a Remote Glassfish using Maven

The maven-glassfish-plugin is a great tool for automating deployment to a Glassfish instance.  The only snag is that the default deployment is to a localhost instance.  There is a well hidden parameter ‘host’ in the domain element however that allows you to deploy to a remote server.

This is the configuration I used in the pom file

I added

<pluginRepository>
     <id>maven.java.net</id>
     <name>Java.net Maven2 Repository</name>
     <url>http://download.java.net/maven/2</url>
 </pluginRepository>

to the pluginRepositories.

Then the following plugin configuration

<plugin>
   <groupId>org.glassfish.maven.plugin</groupId>
   <artifactId>maven-glassfish-plugin</artifactId>
   <version>2.1</version>
   <configuration>
     <glassfishDirectory>C:\Sun\AppServer</glassfishDirectory>
     <user>admin</user>
     <adminPassword>adminpassword</adminPassword>
     <autoCreate>true</autoCreate>
     <debug>true</debug>
     <echo>false</echo>
     <terse>true</terse>
     <skip>false</skip>
     <domain>
       <host>10.42.42.185</host>>
       <name>myproject</name>
       <adminPort>4848</adminPort>
       <httpPort>8080</httpPort>
       <httpsPort>8443</httpsPort>
       <iiopPort>3700</iiopPort>
       <jmsPort>7676</jmsPort>
     </domain>
     <components>
       <component>
         <name>myProject</name>
         <artifact>${project.build.directory}/artifacts/${project.build.finalName}.war</artifact>
     </component>
    </components>
   </configuration>
 </plugin>

 

 


2 Comments to “Deploying a project to a Remote Glassfish using Maven”

  1. Hi,

    Thank you for the tip. Just one question, do you know the underlying protocol used to deploy remotely your artifact ?

    B.R,
    Jerome

  2. “well hidden parameter ‘host’ in the domain element”, well I agree. Thanks a lot! :D

Leave a Reply