users@glassfish.java.net

Re: Remote deployment from Maven / Hudson

From: Jane Young <Jane.Young_at_Sun.COM>
Date: Thu, 25 Mar 2010 10:20:06 -0700

cemerick wrote:
> We need to be able to deploy a web application (packaged as a .war file) to
> remote servers from a maven build process, almost certainly running within
> Hudson. Here's a similar requirement stated just about a year ago:
>
> http://old.nabble.com/Hudson-to-Glassfish-deployment-to22668824.html
>
> It appears that the maven-glassfish-plugin
> (https://maven-glassfish-plugin.dev.java.net) provides no remote-deployment
> capability (unless I'm missing something). Elsewhere on the 'net, I've seen
> recommendations to use maven's exec plugin to script the asadmin executable
> -- something I would certainly like to avoid (i.e. the external, unmanaged
> dependency of a glassfish install just to drive deployments from a build
> environment).
>
In order to deploy remotely, you'll need to have "asadmin" and the
dependent jars installed on the client system. For v3, you'll need to
install the zip bundle.
So here are your options:
1. install glassfish bundle on the client system (manually) and use
https://maven-glassfish-plugin.dev.java.net/deploy-mojo.html. But like
you said, you want to avoid unmanageable glassfish install environment,
so see option 2.
2. in your pom.xml, define the dependency on
"org.glassfish.distributions:nucleus:<version>". The maven repository
is: http://download.java.net/maven/glassfish/.
Download this dependency and expand it. You should be able to do that
using Maven dependency:unpack or use Maven exec or antrun. Then in the
pom, call maven-glassfish-plugin.
> It seems that my other option would be to invert the relationship: use
> glassfish embedded, and simply push new versions of the app + glassfish to
> the servers in question, and coordinate startup/shutdown of app instances
> using something like chef or puppet.
>
Since Maven is more of a tool for development, I think using the
glassfish embedded is probably the better approach. You don't want to
use Maven to deploy apps for production.

HTH,
Jane
> For contrast, that same option is of course available with jetty as well,
> and it appears that the cargo maven plugin supports straightforward
> deployment to remote, established jetty instances:
> http://cargo.codehaus.org/Jetty+6.x
>
> Surely someone is doing continuous deployment with Glassfish. Any pointers
> are most welcome.
>
> Thanks in advance,
>
> - Chas
>