Oracle GlassFish Server 3.0.1 Embedded Server Guide

Maven Goals for Embedded GlassFish Server

You can use the following Maven goals to test your applications with embedded GlassFish Server:

embedded-glassfish:run Goal

This goal starts the server and deploys an application. You can redeploy if you change the application. The application can be a packaged archive or a directory that contains an exploded application. You can set the parameters described in the following table.

Table 3 embedded-glassfish:run Parameters

Parameter 

Default 

Description 

serverID

maven

(optional) The ID of the server to start. 

containerType

all

(optional) The container to start: web, ejb, jpa, or all.

installRoot

In order of precedence: 

  • glassfish.embedded.tmpdir system property value

  • user.dir system property value

  • Current directory

(optional) The Installation Root Directory.

instanceRoot

as-install/domains/domain1

(optional) The Instance Root Directory

configFile

domain-dir/config/domain.xml

(optional) The configuration file. 

port

None. Must be set explicitly or defined in the configuration file. 

(optional) The HTTP port. 

app

None. 

The archive file or directory for the application to be deployed. 

name

In order of precedence: 

  • The application-name or module-name in the deployment descriptor.

  • The name of the archive file without the extension or the directory name.

For more information, see Naming Standards in Oracle GlassFish Server 3.0.1 Application Deployment Guide.

(optional) The name of the application. 

contextRoot

The name of the application. 

(optional) The context root of the application. 

precompileJsp

false

(optional) If true, JSP pages are precompiled during deployment.

createTables

Value of the create-tables-at-deploy attribute in sun-ejb-jar.xml.

(optional) If true, creates database tables during deployment for beans that are automatically mapped by the EJB container.

autoDelete

false

(optional) If true, deletes the contents of the Instance Root Directory when the server is stopped.


Caution – Caution –

Do not set autoDelete to true if you are using installRoot to refer to a preexisting GlassFish Server installation.


embedded-glassfish:start Goal

This goal starts the server. You can set the parameters described in the following table.

Table 4 embedded-glassfish:start Parameters

Parameter 

Default 

Description 

serverID

maven

(optional) The ID of the server to start. 

containerType

all

(optional) The container to start: web, ejb, jpa, or all.

installRoot

In order of precedence: 

  • glassfish.embedded.tmpdir system property value

  • user.dir system property value

  • Current directory

(optional) The Installation Root Directory.

instanceRoot

as-install/domains/domain1

(optional) The Instance Root Directory

configFile

domain-dir/config/domain.xml

(optional) The configuration file. 

port

None. Must be set explicitly or defined in the configuration file. 

(optional) The HTTP port. 

autoDelete

false

(optional) If true, deletes the contents of the Instance Root Directory when the server is stopped.


Caution – Caution –

Do not set autoDelete to true if you are using installRoot to refer to a preexisting GlassFish Server installation.


embedded-glassfish:deploy Goal

This goal deploys an application. You can redeploy if you change the application. The application can be a packaged archive or a directory that contains an exploded application. You can set the parameters described in the following table.

Table 5 embedded-glassfish:deploy Parameters

Parameter 

Default 

Description 

app

None. 

The archive file or directory for the application to be deployed. 

name

In order of precedence: 

  • The application-name or module-name in the deployment descriptor.

  • The name of the archive file without the extension or the directory name.

For more information, see Naming Standards in Oracle GlassFish Server 3.0.1 Application Deployment Guide.

(optional) The name of the application. 

contextRoot

The name of the application. 

(optional) The context root of the application. 

precompileJsp

false

(optional) If true, JSP pages are precompiled during deployment.

createTables

Value of the create-tables-at-deploy attribute in sun-ejb-jar.xml.

(optional) If true, creates database tables during deployment for beans that are automatically mapped by the EJB container.

embedded-glassfish:undeploy Goal


Note –

If you reference a nonembedded GlassFish Server installation using the glassfish-embedded-static-shell.jar file and do not undeploy your applications in the same server life cycle in which you deployed them, expanded archives for these applications remain under the domain-dir/applications directory.


This goal undeploys an application. You can set the parameters described in the following table.

Table 6 embedded-glassfish:undeploy Parameters

Parameter 

Default 

Description 

name

If the name is omitted, all applications are undeployed. 

The name of the application. 

dropTables

Value of the drop-tables-at-undeploy attribute in sun-ejb-jar.xml.

(optional) If true, and deployment and undeployment occur in the same JVM session, database tables that were automatically created when the bean(s) were deployed are dropped when the bean(s) are undeployed.

If true, the name parameter must be specified or tables may not be dropped.

cascade

false

(optional) If true, deletes all connection pools and connector resources associated with the resource adapter being undeployed.

If false, undeployment fails if any pools or resources are still associated with the resource adapter.

This attribute is applicable to connectors (resource adapters) and applications with connector modules. 

embedded-glassfish:stop Goal

This goal stops the server. You can set the parameters described in the following table.

Table 7 embedded-glassfish:stop Parameters

Parameter 

Default 

Description 

serverID

maven

(optional) The ID of the server to stop.