A simple maven plugin for Glassfish: asadmin-maven-plugin
To seamlessly use Glassfish from maven projects, JSR-88 seems to be answer. The cargo maven plugin has JSR-88 support planned but this will take time.
I published some days ago a maven plugin that simply wraps the asadmin command and aims to provide maven integration for starting, stopping glassfish and deploying and undeploying applications and modules.
Go to the Google Code page of asadmin-maven-plugin to download a preview version named asadmin-maven-plugin-0.1-SNAPSHOT : http://code.google.com/p/asadmin-maven-plugin/
The api is designed for easy extensibility so feel free to submit contributions !
Install the jar provided in the download section in your local repository and add this to your pom :
<build>
<plugin>
<groupId>org.n0pe.mojo</groupId>
<artifactId>asadmin-maven-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
</plugin>
</build>
Check that either AS_HOME or GLASSFISH_HOME environment variables are set to your SJAS/Glassfish installation folder.
You can now use the following commands :
- mvn asadmin:start-database
- mvn asadmin:start-domain
- mvn asadmin:deploy
- mvn asadmin:undeploy
- mvn asadmin:stop-domain
- mvn asadmin:stop-database
By default the asadmin-maven-plugin use the following settings :
- user: admin
- password-file: ~/.asadmintruststore
- admin-host: localhost
- admin-port: 4848
- domain: domain1
You can override all theses settings in the plugin configuration section in your pom.xml. Full documentation will soon be provided but if you have a maven aware editor, you will get completion on available options.
By default again, the deploy and undeploy mojos use the archive (jar/war/ear) produced by your maven project and deploy it using your project’s artifactId as module name.
The next step is to provide user and developer documentation.

quote: Install the jar provided in the download section in your local repository
I cannot find any docs about a download section in my repository. Can you point me to something, please?
philion
March 25, 2008 at 9:44 pm
Hi Philion,
You can use the deploy:deploy-file mojo from the maven-deploy-plugin as described there : http://maven.apache.org/plugins/maven-deploy-plugin/usage.html
I’m currently setting up a public repository to ease this particular step.
Regards
Paul
eskatos
March 26, 2008 at 12:06 am