During JavaOne I was told that people were asking if GlassFish has ant tasks support.
The answer is YES, GlassFish provides an ant utility called "asant". "asant" is a wrapper script that calls ant. ant 1.6.5 is included in GlassFish V2. Using "asant" will allow you to use the built-in ant tasks to administer/configure/deploy application to GlassFish Application Server.
Following are the supported built-in ant tasks:
- sun-appserv-deploy -- deploys J2EE components to GlassFish
- sun-appserv-undeploy -- undeploys J2EE components from GlassFish
- sun-appserv-component -- enables/displabes J2EE components
- sun-appserv-admin -- executes asadmin subcommands
- sun-appserv-jspc -- pre-compiles of JSP source code
- sun-appserv-update -- deploys application (EAR) and standalone modules (EJB, JAR, RAR, WAR) to be updated and reloaded.
- sun-appserv-instance -- lifecycle of GlassFish instances
- wsimport -- imports JAX-WS portable artifacts
- wsgen -- generates JAX-WS portable artifacts used in JAX-WS web services
- JBI OpenESB Tasks
asant is located in your <GlassFish-install-dir>/bin or <GlassFish-build-dir>/public/glassfish/bin. It's in the same directory as asadmin.

Posted by Ludo on June 01, 2007 at 10:53 AM PDT #
The JAR file that contains these Ant tasks is install/lib/sun-appserv-ant.jar.
asant just makes sure your environment is set up to use these tasks, but for a vanilla ant install, you just need an init target that defines the tasks in sun-appserv-ant.jar.
E.g. <target name="as-ant-init"> <taskdef name="sun-appserv-deploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask"> <classpath path="install/lib/sun-appserv-ant.jar"/> </target>
Posted by Ian on June 26, 2007 at 12:04 PM PDT #