Using Embedded Glassfish with Maven
Three steps to add Embedded GlassFish to any existing project POM.
The Embedded Glassfish
project is hosted on java.net
, and as it is described, is very simple: “This project develops APIs and tools around “embedded GlassFish v3″. Embedded GFv3 is a delivery vehicle of GFv3 so that applications and tools can use GFv3 just as a library, inside their JVM, instead of having GFv3 as the overload of the entire JVM process. (And no, embedded GFv3 is not meant to be run on JavaME.)”
1. You’ll need to add this plugin repository to your POM:
2. Then add the following plugin to your POM:
- embedded-glasfish:run – starts the embedded server if it is not already running and deploys the specfied application. The goal keeps the server running, so the user can make changes in the application, reploy and test iteratively.
- embedded-glassfish:start – starts the embedded server with the specified parameters
- embedded-glassfish:deploy – deploys the specified application
- embedded-glassfish:undeploy – undeploys the application identified by the “name” parameter. If no name is specifed all applications are undeployed.
- embedded-glassfish:stop – stops the embedded server
- embedded-glassfish:admin – executes the specified admin command on the embedded server. For example, you could create a jdbc resource.