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.
Ensure that your Maven environment is configured.
Include the path to the Maven executable file mvn in your path statement.
Ensure that the JAVA_HOME environment variable is defined.
Create a directory for the Maven project for your application.
Copy to your project directory the POM file that you created in To Set Up Your Maven Environment.
Run the following command in your project directory:
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.