- GlassFish Full Build Instructions
- Re-build from existing workspace,
- Running V3
- Building Offline
- Kenai Migration
- Building Embedded
- Decision Regarding Binary Class Version of GlassFish Build.
- Unable to build because maven.glassfish.org is offline
- trunk -> maven 3.0.3 or above
- 3.X -> maven 2.2.1 only
MAVEN_OPTS environment variable must include the following:
Not using the above setting will likely cause an OutOfMemoryException.
- trunk -> JDK 1.7 Update Release 9
- 3.x -> JDK 1.6 Update Release 4 or above, JDK 1.7 is not supported
Settings.xml (only required for building 3.x)
You need to have the following mirror element in <user.home>/.m2/settings.xml so that all Maven artifacts are downloaded from Maven Central except for EclipseLink artifacts.
To checkout the entire trunk workspace,
If you don't have svn, please download it here.
To checkout the 3.1.2 workspace,
To checkout the 3.1.1 workspace,
To checkout the 3.1 workspace,
To checkout the 3.0.1 FCS workspace,
To checkout the 3.0 FCS workspace,
To checkout the V3Preview workspace,
To checkout the V3Prelude workspace,
Tip: If you don't have svn installed, you can use mvn to checkout trunk workspace:
This command will create a subdirectory 'main' 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
Note: if you get a java OutOfMemory Error while running the mvn command, add this entry to your shell's rc file or environment:
Tip: If you want to dedicate a maven local repository:
You can use the "-U" option if you want maven to check and download the updated SNAPSHOT and release artifacts. However, build will take much longer using this option. If you have one successful build which means your local Maven repository (by default it's <user-home>/.m2/repository) is populated with the artifacts referenced in GlassFish v3 workspace, then you don't need to use "-U".
You can use the "clean" target if you want maven to delete the modules' target directories and force maven to build all the modules. Without the clean target, maven will build the modules that have been modified.
NOTE if your code change impacts other modules, it is recommended that you do a "clean".
Also, once you have a successful build, you can build selected modules in the v3 directory by using the "-pl or --projects" option.
If you already have a GlassFish installation and would like to update that jar files built in your workspace to the installed glassfish/modules directory, you can either directly copy to the glassfish/modules directory or create a symlink in Unix/Linux or use Junction in Windows OS (see here.
Currently the Maven GlassFish Build plugin's "run" goal (described here) is broken due to changes in the GlassFish launcher code. Once this is fixed, you can also use this option to start domain with the artifacts built in your workspace.
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: main/appserver/distributions/glassfish/target, named glassfish.zip.
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.
Unzip the distribution in your favorite directory and do
where the option --verbose|-v starts the server embedded, in the same vm and displays the server log on the console
you can then use the asadmin client to deploy applications
Note: Make sure that you are using JDK 1.6 update release 4 or above and it must be in the path.
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:
If you have an existing workspace from java.net (Collab) and would like to switch to the new java.net (Kenai) infrastructure, please use switch --relocate command.
You must first build main workspace and have a local Maven repository containing the main/appserver and main/nucleus artifacts. The embedded workspace will need to reference the same local Maven repository used for building main. If you're not using the default Maven repository, (<home>/.m2/repository), you can set the local Maven repository with the property -Dmaven.repo.local=... on the command line. If you just want to build embedded without building v3, the v3 SNAPSHOT artifacts from the remote Maven repository will be used to assemble the embedded artifacts.
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 <java6>/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:
- GlassFish v3 must be run with Java 6+ runtime only. (Can someone clarify if it applies to all the distro's?)
- 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.
- 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.
- asadmin will detect an attempt to run GlassFish with Java 5 Runtime See: 7038 and will flag it as an error.
The GlassFish Nexus Server (maven.glassfish.org) is offline due to internal infrastructure changes.
This of course impacts GlassFish builds. Since almost all GlassFish dependencies are available in Maven Central, except for EclipseLink artifacts, you'll need to create a mirror element in settings.xml:
For 3.x, you'll need to add the following profile in settings.xml: