Build GlassFish V2.1.1 Project
For GlassFish V3 and beyond (3.1.x, 4.0), refer the build pages HERE
Prerequisites to building GlassFish
Quickstart Guide
Complete Build Instructions
Building from the Branch
GlassFish Maven Goals Overview

This page describes how to build GlassFish V2.  Here are useful links if you want to submit a bug or request a feature. You can find the governance policy here.

Complete Instructions on how to Build GlassFish V2

Command line options for building GlassFish are below.

Prerequisites to building GlassFish.
  • The users must have Maven (1.0.2) installed: This will create the local repository needed by Maven to store GlassFish dependencies.
  • The user must have a login on java.net and must have access to the CVS repository for the GlassFish project.
  • The user must login to the GlassFish CVS repository once (so CVS saves the password in the .cvspass file in the user's home directory)
  • J2SE 5.0 (1.5.0_12) must be installed, configured as JAVA_HOME env variable and in your binary path.  We recommend that you use the latest version available. 
  • Setup a cvs client per java.net instructions.
GlassFish build steps:
The first step is to checkout the module dependencies and common files used in the build system and edit the properties file.
% mkdir workspace
% cd workspace
% cvs -d :pserver:<userid>@cvs.dev.java.net:/cvs checkout -r SJSAS91_FCS_BRANCH glassfish/bootstrap
This will checkout project.xml, maven.xml, project.properties, and common files referenced from project.xml.
Create  workspace/glassfish/bootstrap/build.properties or for re-usable GlassFish workspace, one-time process is to create ${HOME}/build.properties (Unix)  or %HOMEPATH%\build.properties (Windows) and  set following variables: (you can get %HOMEPATH% value by running the command: echo %HOMEPATH% or run "set" and find HOMEPATH variable (windows))
Define two glassfish variables glassfish.os.name, glassfish.cvs.username same as above.
glassfish.os.name= <OS name - possible values are WINNT, SunOS, Linux, SunOS_X86, Darwin>
glassfish.cvs.username= <java.net id>
    For example, on Windows XP Professional

glassfish.os.name=WINNT
glassfish.cvs.username=carlavmott

  • Next checkout the sources.
  • % cd glassfish/bootstrap
    % maven checkout
    Known limitation: Some of the sources needed for building GlassFish may not be available on java.net right away (for example MQ, the ORB, JWSDP 2.0, etc).  These will be treated as binary dependencies for the time being. (See the next step for how binary dependencies are used.) You can also checkout a subset of the modules by calling:
    % maven checkout -Dmodules=[comma separated list of module-names]   

    The module-names are on this page.

  • Bootstrap the server image (a collection of scripts and jar files used to run glassfish). Developer can select the option of "bootstrap" which downloads the pre-built server and builds only subset of the modules. Other option "bootstrap-all" is to create the server from scratch, and build all the modules to verify the intermodule or binary dependencies version change.

  • bootstrap-all option: Building all the modules from the source.
    % maven bootstrap-all 
    bootstrap option: Build your own module using pre-built server
    % maven bootstrap
    This step is optional if you have already installed a promoted build of GlassFish.  To use the promoted build you will need to set the property in glassfish/project.properties.
    glassfish.image.version=<<build version>>
    This will cause the build system to "point" to that installation. This property can also be added to ${HOME}/build.properties

  • Build the checked out source code. The order of compilation will be driven by a common configuration file checked out in step 2 above. This step will update the installed image at the end of compiling each module.
  • % maven build
    You can always build a subset of the modules by invoking:
    % maven build -Dmodules=[comma separated list of module-names] 
    or go to ../[module-name] and invoke:
    % maven build
  • Configure the GlassFish Server runtime.  This step will create the asadmin script, run create-domain, etc which are needed to run the GlassFish server.
  • % maven configure-runtime   (Default is silent installation) 
    If you would like to specify common configuration information (for example, port numbers etc.), use configure-runtime in verbose mode.  
    % maven configure-runtime -Dinteractive
    In general you will only need to run this command once.  Cases where you are changing the domain environment will require reconfiguration, see the FAQ for more informations.  Default values for runtime configuration can be found in glassfish/bootstrap/project.properties:
    domain.name="domain1"
    instance.name="server"
    admin.user="admin"
    admin.password="adminadmin"
    admin.port="4848"
    instance.port"="8080"
    orb.port="3700"
    imq.port="7676"
    https.port="8181"
    Maven goal 'configure-runtime' will create single-instance domain similar to GlassFish V1. If you want to create cluster mode domain of GlassFish V2, run following command:
    % maven configure-cluster
  • Start the server using the following command. All GlassFish server commands are located in the <glassfish.root>/publish/bin directory.  For more documentation on how to administer the server please refer to the documentation for the Sun Java System Application Server PE version 8 seriers.  A great amount of what is there still applies to version 9.  Note:  currently GlassFish only supports command line option for all platforms. 

  • % asadmin start-domain
  • Cleaning the server. 

  • % maven clobber
    This will remove all the scripts and jar files used to run the server. It will remove everything under glassfish.home and once this is done you will need to go back to step 2.

  • Clean Build/Server: You can use any of the above three goals during your development process. Update the sources using your favorite IDE, and use any of the following commands on already built workspace to bring the workspace to its original stage to rebuild and verify your changes.
    • To clean the modules to delete build generated files like .class, .properties and ready to recompile, run following command
      % maven clean (or maven -Dmodules=mail,activation clean)
    • To clean the server configured in step 5 above, use command below to clean the server which deletes Administration Server, domain1 and preserves the server back to original installed stage. (Deletes newly generated token replaced files in ${glassfish.home}/bin, config directories.)
      % maven clean-config
    • You can use "maven clean-config" if you want to verify your changes related to domain and administration server startup related. "clobber" goal can be used to delete your server to get new server. "clean" can be used to delete build files and ready to compile.

  • Run Quicklook Tests: Quicklook Tests are meant to give the developer a way of testing major functionality in the Application Server and of running a sanity check to ensure that nothing major is broken.
    • Checkout the required test failes from glassfish/appserv-tests as below.
    % cd glassfish/bootstrap
    % maven checkout-quicklook
  • Set APS_HOME. This is the directory where you checked out the workspace including the workspace root name (e.g. /workspace/appserv-tests)
  • Set S1AS_HOME. This is installation directory for the GlassFish Server (e.g. /workspace/publish/glassfish)
  • The installation properties are under ${APS_HOME}/config.properties to match your installation (e.g. admin.password, http.port, etc.). If you changed any default values, edit this config.properties file.
  • Make sure the server is NOT running before running the tests, stop the server if its already running.
  • Run the test:
    % cd $APS_HOME
    % maven runtest
  • Open the ${APS_HOME}/test_results.html file in a browser and examine the results.
    • You can find the detailed instructions to run Quicklook tests HERE.

    Remember to check the GlassFish Build FAQ wiki if you run into problems.

    IDE support


    For additional information, review the workspace guidelines and commit procedures

    Building Glassfish for V2.1, SGES21_FS_BRANCH :

    Following are the steps to build from GlassFish Branch:
    % mkdir workspace
    % cd workspace
    % cvs -d :pserver:<userid>@cvs.dev.java.net:/cvs checkout -r SGES21_FCS_BRANCH glassfish/bootstrap

    As glassfish/bootstrap/project.properties from SGES21_FCS_BRANCH branch has variable "glassfish.cvstag" set as "glassfish.cvstag=SGES21_FCS_BRANCH". The FCS branch sources will be checked out and built accordingly.

    Define two glassfish variables glassfish.os.name, glassfish.cvs.username same as above.

    Then:
    % cd glassfish/bootstrap
    % maven checkout bootstrap-all build configure-runtime

    You can decide which goal to run between bootstrap and bootstrap-all in above commands, by going through the details here.

    GlassFish Maven Goals Overview:

    Goal Name
    Commonly used command
    Description
    bootstrap
    maven -Dmodules=admin bootstrap checkout build
    Dowload glassfish-image-SNAPSHOT.jar file and unzip the file under the ${glassfish.home}(Server Image) to build individual modules
    bootstrap-all
    maven checkout bootstrap-all build
    Install an empty glassfish image that only contains the binaries dependencies, then download individual binary dependencies and unzip them into ${glassfish.home} and builds all modules from Sources.
    checkout maven checkout
    Checking out a module
    build
    maven build
    Building the module
    configure-runtime maven configure-runtime
    Configuring ${glassfish.home} with single-instance domain
    configure-cluster
    maven configure-cluster
    Configuring Domain with clustering features for GlassFish V2
    clean maven clean clobber
    Clean the module
    clobber
    maven clobber
    Cleans GlassFish server image - deletes directory ${glassfish.home. Need to be used with "bootstrap-all" to get new image to clean any corrupted server image.
    clean-config
    maven clean-config
    Cleans Server. Delete domain1 and token replaced files in bin,config
    -Dmodules=
    maven -Dmodules=admin bootstrap checkout build Clean/Check out/Build only some modules: maven -Dmodules={comma separated list} goal name


    Terms of Use; Privacy Policy; Copyright ©2008-2012 (revision 20120430.2938d5f)
     
     
    Close
    loading
    Please Confirm
    Close