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.
% mkdir workspaceThis will checkout project.xml, maven.xml, project.properties, and common files referenced from project.xml.
% cd workspace
% cvs -d :pserver:<userid>@cvs.dev.java.net:/cvs checkout -r SJSAS91_FCS_BRANCH glassfish/bootstrap
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
% cd glassfish/bootstrapKnown 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
% maven checkout -Dmodules=[comma separated list of module-names]
The module-names are on this page.
bootstrap-all option: Building all the modules from the source.
% maven bootstrap-allbootstrap option: Build your own module using pre-built server
% maven bootstrapThis 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
% maven buildYou 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
% 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 -DinteractiveIn 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"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:
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 configure-clusterStart 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 clobberThis 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.
- 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.
- Checkout the required test failes from glassfish/appserv-tests
as below.
% cd glassfish/bootstrap
% maven checkout-quicklook
APS_HOME. This is the directory where you
checked out the
workspace including the workspace root name (e.g. /workspace/appserv-tests)S1AS_HOME. This is installation directory
for the GlassFish Server (e.g. /workspace/publish/glassfish)${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.% cd $APS_HOME
% maven runtest
${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 |
