Home Index Changes Prefs Log in »

GlassFish V3 Full Rebuild Instructions

These instructions are for those who want to fully rebuild everything from scratch. Most developers should follow V3DevelopmentInstructions.

Maven version

You must use Maven 2.0.9, as previous versions of MAVEN have led to issues building v3. If you see a compilation error relating to ".../PwcCoyoteRequest.java:146: cannot find symbol" then most likely you are using a pre-2.0.9 versions of Maven. There is known issue in Maven where HashSet is used to store classpath thus resulting in unpredictable ordering of classpath during compilation.

Do not use Maven 2.2.0 as there are critical regressions in this version and you will not be able to compile GFv3.

If you don't have Maven installed, download it here.

JDK version

You must use JDK 1.6 Update Release 4 or above to build GlassFish v3 and make sure that it's in the PATH. Please note, we need update release 4 of JDK 1.6 because Metro depends on some new JAX-WS APIs.

Checkout the workspace

To checkout the entire V3 workspace,

svn checkout https://svn.dev.java.net/svn/glassfish-svn/trunk/v3
If you don't have svn, please download it here.

To checkout the V3Preview workspace,
svn checkout https://glassfish-svn.dev.java.net/svn/glassfish-svn/branches/3.0-Preview

To checkout the V3Prelude workspace,

svn checkout https://svn.dev.java.net/svn/glassfish-svn/branches/v3_prelude_release 


Tip: If you don't have svn installed, you can use mvn to checkout V3 workspace:

mvn scm:checkout -DconnectionUrl=scm:svn:https://svn.dev.java.net/svn/glassfish-svn/trunk/v3 -DcheckoutDirectory=v3
This command will create a subdirectory 'v3' from the directory where you run the command. You can do the same for V3Prelude workspace by replacing the URL.


After that, perform the following steps to build GFv3

cd v3
mvn -U -Prelease-phase1 install
mvn -U install

Note: if you get a java OutOfMemory Error while running the mvn command, add this entry to your shell's rc file or environment:

export MAVEN_OPTS=-Xmx512m

For re-build from existing workspace,

cd v3
svn update
mvn -U clean install

At the end of this, you will have various distributions. These distributions are nothing but zip files with specific Main Class and contents. For example, one of the distributions is the GlassFish distribution available at: /distributions/glassfish/target, named glassfish.zip.

Tip: If you want to dedicate a maven local repository:

mvn -Dmaven.repo.local=/tmp/m2 clean install 

Note that the so-called "admin domain" is already available as a zipped-up folder with prebuilt structure. This is a deviation from how GlassFish V2 used to install/create the domain.

Running V3

Unzip the distribution in your favorite directory and do

glassfish/bin/asadmin start-domain [--verbose|-v]
where the option --verbose|-v starts the server embedded, in the same vm and displays the server log on the console or
java -jar glassfish/modules/glassfish.jar

you can then use the asadmin client to deploy applications

bin/asadmin deploy foo.war

Note: Make sure that you are using JDK 1.6 update release 4 or above and it must be in the path.

Building Offline

You can build offline if you have all the external dependencies downloaded in the local Maven repository. The dependencies are downloaded if you have a previously successful v3 build. To build offline, use the following command:
mvn -DskipTests=true  -o clean install
You need to add -DskipTests=true to skip the unit tests since the acc-config unit test is retrieving the DTD over the network when using JAXB to convert XML files to Java code. See: IT 4756

Decision Regarding Binary Class Version of GlassFish Build.

This was discussed during the engineering meeting on Tuesday 17 Feb 2009.

Since by definition, Java EE 6 requires Java SE 6 runtime, it is obvious that we use Java 6 for compilation. Thus, the javac used for compilation of Java sources in GlassFish v3 trunk is /bin/javac (or its equivalent). Now, the target for such a build is Java 6 runtime. Thus, by default, i.e. if we don't specify the -target option on javac, the generated classes would have a Major Version of 50.0 (which corresponds to Java 6). Thus, if we did that, all the modules will only create classes that can be loaded by Java 6 runtime. In order to support Java 5 runtime (ListOfV3ModulesSupportingJava5Runtime) which might be required by some of the components (although their source are checked in to v3 trunk), here is the decision taken:

  1. GlassFish v3 must be run with Java 6+ runtime only. (Can someone clarify if it applies to all the distro's?)
  2. We use javac from Java 6 for compilation. Because of that, any module can declare compile-time dependencies on Java 6 classes, e.g. java.io.Console.
  3. We use -target as 1.5 which means, by default, the major version of classes generated by build would be 49. This is to take care of running certain modules with Java 5 runtime.
  4. asadmin will detect an attempt to run GlassFish with Java 5 Runtime See: 7038 and will flag it as an error.
« Home Attachments Info Index Changes Prefs
This page (revision-63) was last changed on 11-Nov-09 07:14 AM, -0800 by Jane Young