Oracle GlassFish Server 3.0.1 Embedded Server Guide

ProcedureTo Build and Start an Application From Maven

If you are using Maven to manage the development of your application, you can use a Maven goal to build and start the application in embedded GlassFish Server.

Before You Begin

Ensure that your Maven environment is configured.

  1. Include the path to the Maven executable file mvn in your path statement.

  2. Ensure that the JAVA_HOME environment variable is defined.

  3. Create a directory for the Maven project for your application.

  4. Copy to your project directory the POM file that you created in To Set Up Your Maven Environment.

  5. Run the following command in your project directory:

    mvn install

    This command performs the following actions:

    • Installs the Maven repository in a directory named .m2 under your home directory.

    • Starts embedded GlassFish Server.

    • Deploys your application.

    The application continues to run in embedded GlassFish Server until embedded GlassFish Server is stopped.