Get started with Maven Plugin of Embedded GlassFish Server Open Source Edition 3.1
To start using Embedded GlassFish Server Open Source Edition 3.1 in your Maven project, all you need to do is to have the following configuration in your pom.xml:
<project> ... <packaging>ear|ejb|jar|rar|war</packaging> ... <build> ... <plugins> <plugin> <groupId>org.glassfish</groupId> <artifactId>maven-embedded-glassfish-plugin</artifactId> <version>3.1</version> <configuration> <app>target/test.war</app> <name>test</name> <ports> <http-listener>8080</http-listener> <https-listener>8181</https-listener> </ports> </configuration> <executions> <execution> <goals> <goal>start</goal> <!-- this will run during pre-integration-test phase --> <goal>deploy</goal> <!-- this will run during pre-integration-test phase --> <goal>undeploy</goal> <!-- this will run during post-integration-test phase --> <goal>stop</goal> <!-- this will run during post-integration-test phase --> </goals> </execution> </executions> </plugin> <!-- Run maven tests during integration-test phase. Because the Embeddeded GlassFish should be up & running with the app deployed in order to run the tests. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> <executions> <execution> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> </configuration> </execution> </executions> </plugin> ... </plugins> ... </build> ... <repositories> <repository> <id>glassfish-releases</id> <url>http://download.java.net/maven/glassfish</url> </repository> </repositories> ... </project>
In 3.1 version of the plugin, lot of new configuration options are added to start/admin/deploy/undeploy goals.
I have made the complete 3.1 plugin documentation available at http://embedded-glassfish.java.net/nonav/plugindocs/3.1/plugin-info.html
Please read the plugin documentation for the new configuration options. If you come across any issues while using the plugin or have any questions about it, please write to users@glassfish.java.net or users@embedded-glassfish.java.net
In addition to the plugin document, as a reference, there are plenty of tests @ http://java.net/projects/glassfish/sources/svn/show/trunk/v3/tests/embedded/maven-plugin which use this plugin.
- Printer-friendly version
- bhavanishankar's blog
- 2463 reads





