Building GlassFish v2 from source

Why build from source? First, because as with any open source projects, if there’s a bug \*you\* can fix it. Second because you can get money for that. Finally, because even with GlassFish v3 Prelude around the corner, GlassFish v2 is still going to be in production for a long period at many customer sites.

v3 is very easy to build using the latest and greatest svn and mvn while building GlassFish v2 from source still requires CVS, maven 1.0.2 (1.1 doesn’t work) and Java 5 (no Java 6). All this is detailed on this wiki page. The following is a stripped down version of the process for GlassFish v2ur2 (tagged SJSAS91_UR2_BRANCH).

Update: the tag for v2.1, released in January 2009 is SJSAS-9_1_1-B60E-23_Dec_2008.

Update: the tag for v2.1.1, released in october 2009 is SJSAS-2_1_1-B31G-19_Oct_2009.

First, make sure you have Java 5 as de default version by setting JAVA_HOME appropriately. Also set MAVEN_HOME to use 1.0.2 and MAVEN_OPTS to "-Xmx1024m". Finally, have $HOME/ configured (or pass those as -D maven options):<OS Name: Possible values : WINNT | SunOS | Linux | SunOS_X86 | Darwin>


The first step is the CVS checkout of the bootstrap (first magic string is the branch tag):

% cvs -d login

% cvs co -r SJSAS91_UR2_BRANCH glassfish/bootstrap

% cd glassfish/bootstrap

This should complete in a matter of seconds.

The second step combines the full checkout and build process (second magic string is the correct set of maven goals)

% maven bootstrap checkout build build-jarinstaller

Checking out the entire source tree takes 15 minutes (modulo your bandwidth of course). The rest of the process takes another 15 minutes on my fairly recent laptop (and compiles around 10k classes in the process). The resulting installer jar can then be found in the ./publish directory:

% ls ./publish/\*.jar


The -Dmodules= flag helps you checkout or build a specific set of modules. This and a lot more is documented on the wiki. Julien discussed building v3 a few weeks back. Whatever the version, remember we like bug reports and patches even more! :)


Author: alexismp

Google Developer Relations in Paris.

5 thoughts on “Building GlassFish v2 from source”

  1. Hi Alexis,
    I’ve tried very hard to build "v2" in the last days but unfortunately I didn’t succeed. I think this is because I couldn’t get CVS working because I’m behind a firewall which doesn’t support tunneling.
    In fact I only wanted to try the Glassfish tests, so I installed a binary version of Glassfish and checked-out the tests (glassfish/appserv-tests) from the SVN-server. But "maven runtest" from the appserv-tests directory still fails, although I have the right version of maven (1.0.2) and Java (1.5).
    Do I really have to have a running CVS client with unrestricted access to the internet if I want to execute ANY maven target in version "v2"?
    Has this really changed for "v3" – i.e. doe’s it only use SVN instead of CVS? The build documentation on the Glassfish pages ( is very "CVS"-centric and doesn’t say a word about SVN (or at least I couldn’t find it). Oh I just found it, it’s hard to find because it’s only in the Wiki, but it’s there:
    I’ll give it a try..

  2. Hi Volker,
    Alexis forwarded me your questions about the GlassFish v2 quick look tests and CVS. The tests are meant to run against a GlassFish build meaning that the glassfish sources have been checked out and the appropriate maven command (maven checkout bootstrap build build-jarinstaller) has been ran to create the GlassFish binaries in the <ws>/publish directory.
    However, since you are using the GlassFish binaries, I think you should be able to run the tests using the following steps:
    % mkdir <ws>
    % cvs co glassfish/bootstrap
    % unzip GlassFish binaries in <ws>/publish
    % cd <ws>/glassfish/bootstrap
    % maven<whatever OS> -Dglassfish.home=<ws>/publish configure-runtime -Dsilent
    % maven -D glassfish.cvs.username=<your id> checkout-quicklook
    % cd <ws>/glassfish/glassfish/appserv-tests
    % maven runtest
    Let us know if you still run into problems.

  3. Hi Terena,
    thanks for your comments. But as I wrote, the problem is, that I can’t get CVS working because I’m behind a firewall. So I checked out all the v2-sources (including the tests) using SVN. Now my impression is that if I run "maven runtest" from these sources, maven still needs to call CVS for some reasson before it actually runs the tests.
    My question was if there’s really a dependency to CVS if I have the whole soure tree with the tests and a glassfish binary or if I did just another mistake? Or in other words: can I just chekcout the "appserv-tests" with SVN and run them against an installed version of glassfish without any other dependnecies (exept maven and Java of course)?

Comments are closed.