Using the maven-embedded-glassfish-plugin

Here is my first working XML for running unit tests against an application deployed on an embedded glassfish v3 instance:

<plugin>
   <groupId>org.glassfish</groupId>
   <artifactId>maven-embedded-glassfish-plugin</artifactId>
   <version>3.0</version>
   <configuration>
      <goalPrefix>glassfish</goalPrefix>
      <app>App.war</app>
      <port>8080</port>
      <contextRoot>App</contextRoot>
   </configuration>
   <executions>
      <execution>
         <id>start-glassfish</id>
         <phase>generate-test-resources</phase>
         <goals>
            <goal>start</goal>
         </goals>
      </execution>
      <execution>
         <id>deploy-glassfish</id>
         <phase>pre-integration-test</phase>
         <goals>
            <goal>deploy</goal>
         </goals>
      </execution>
      <execution>
         <id>stop-glassfish</id>
         <phase>post-integration-test</phase>
         <goals>
            <goal>stop</goal>
         </goals>
      </execution>
  </executions>
</plugin>

Leave a Reply

Your email address will not be published. Required fields are marked *