Overview
This documents how to build the Apache Geronimo Server project.
This guide is intended to cover how to build the latest server/branches/2.2
. Refer to Building Apache Geronimo in the Development documents for more information on building Geronimo, including this and other branches.
Prerequisites
Java Developer Kit (JDK)
You will need a JDK 5.0+ (J2SE 1.5.0+) or compatible JDK to build Apache Geronimo. It is recommended you use SUN's implementation, or something compatible like Apples implementation. Other JDK vendors implementations may work, but use at your own risk.
Apache Maven 2
To execute the build process you need to have Apache Maven version 2.0.9
(or newer) installed. Note that Geronimo 2.2.x does not build with Maven 3.0 or above.
To check if your installation is working and you have the required minimum version run:
And it should produce something like:
No Format |
---|
Maven version: 2.0.9
|
If you have an incompatible version the server build will probably fail with a message complaining ![(wink)](/confluence/s/p9b4rx/8804/1naq7q0/_/images/icons/emoticons/wink.svg)
Tip |
---|
|
Add the following to your settings.xml for maven so that you can avoid the redirect (and hence avoid the bogus poms/jars) and get beyond compilation failure problem to build Geronimo using maven. See this message for more details. Code Block |
---|
| xml |
---|
| xml |
---|
title | excerpt of setting.xml for maven |
---|
|
...
<mirrors>
<mirror>
<id>java.net</id>
<name>Mirror of https://maven-repository.dev.java.net/nonav/repository/</name>
<url>http://download.java.net/maven/1/</url>
<mirrorOf>java.net</mirrorOf>
</mirror>
</mirrors>
...
|
|
Subversion
To fetch the source code for the server, you will need to have a Subversion client version 1.2 (or newer, 1.4 is recommended) installed.
Tip |
---|
|
Windows users are strongly encouraged to change the M2 local repository (the place where dependencies are downloaded) to a shorter path with no spaces, e.g. C:\.m2 . Using a longer path may cause the build (and Geronimo itself) to behave very strangely when it hits the 260 char limit for filenames on Windows. In order to change the m2 local repository go to %USERPROFILE%\.m2 and edit or create settings.xml file to contain the following content: Code Block |
---|
|
<?xml version="1.0"?>
<settings>
<localRepository>C:\.m2</localRepository>
</settings>
|
|
Checkout Geronimo
No Format |
---|
svn co https://svn.apache.org/repos/asf/geronimo/server/branches/2.2 server22
|
Tip |
---|
|
If you are using Chinese system, please change your locale to en_US. Otherwise, the maven 2.0.7(or below) can't parse Chinese characters. |
Tip |
---|
|
Windows users are strongly encouraged to checkout Geronimo into c:\g . Using a longer path may cause the build (and Geronimo itself) to behave very strangely when it hits the 260 char limit for filenames on Windows. |
Starting from 2.2, you can also use Git mirrors to checkout Geronimo source code, using the following command:
No Format |
---|
git clone git://git.apache.org/geronimo server
|
Preparing to Build for the First Time
Chances are you will need to increase the heap size for Maven. Add the following lines to ~/.mavenrc
:
Note |
---|
The following snips only set MAVEN_OPTS if its not already set, so that you can override these values on the command line if needed. |
No Format |
---|
# Increase the heap size Maven
if [ "x$MAVEN_OPTS" = "x" ]; then
MAVEN_OPTS=-Xmx512m
fi
|
If you are using the SUN JDK (or a JDK with compatible flags, like the Apple JDK), you should also increase the maximum permanent size as well as the heap:
No Format |
---|
# Increase the heap and max permanent size for Maven
if [ "x$MAVEN_OPTS" = "x" ]; then
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"
fi
|
Tip |
---|
|
Windows users should create mavenrc_pre.bat under c:\documents and settings\<username>\mavenrc_pre.bat or c:\mavenrc_pre.bat depending on how the %HOME% property is set on your system. Variables will need to use the batch set syntax: No Format |
---|
set <VARIABLE>=<VALUE>
|
|
Building
To build all changes incrementally:
To perform clean builds, which are sometimes needed after some changes to the source tree:
No Format |
---|
mvn clean install
|
Building Stages
In some cases you may need to build Geronimo in stages, such as when building OpenEJB from source to pick up local changes. Most users will not need to do this, but its documented here for clarity.
To build modules, testsupport and maven-plugins:
No Format |
---|
mvn install -Dstage=bootstrap
|
To build apps, configs and assemblies:
No Format |
---|
mvn install -Dstage=assemble
|
As mentioned, most users will not need to build Geronimo in stages. But in some cases, when bootstrapping new versions (when no artifacts are deployed into remote repositories for the current version), then you must build the stages separately for the first build and then for all builds afterwards, the staged build is not necessary.
Note |
---|
If you encounter errors downloading dependencies from the ibiblio maven mirror, adding the following to your settings.xml file may help avoid the problem: Code Block |
---|
|
<settings>
<!-- central repo repo1 is mirrored to ibiblio. explictly overriding that to be repo1 itself -->
<mirrors>
<mirror>
<id>ibiblio.org</id>
<name>Mirror of http://repo1.maven.org/maven2/</name>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
|
|
Testing the Assembly
Once you have build the server fully, which will produce a number of zip
and tar.gz
archives from the assembly modules, you can use the geronimo-maven-plugin
to start the server. From the project root directory run:
No Format |
---|
mvn -Ptools geronimo:start
|
Tip |
---|
|
Windows users may need to specify an alternative installDirectory to avoid long path problems: No Format |
---|
mvn -Ptools geronimo:start -DinstallDirectory=c:\g
|
|
And to stop, either CTRL-C
or from a separate terminal, from the project root directory run:
No Format |
---|
mvn -Ptools geronimo:stop
|
IDE Setup
The server project does not have any IDE files checked in, they are all generated by Maven plugins. Once you have checked out the server tree and built it once, you can generate the project configuration files for your IDE.
Intellij IDEA
For the basic IDEA configuration:
To generate a configuration which includes dependency sources and javadocs:
No Format |
---|
mvn -Pdefault,idea
|
Eclipse
No Format |
---|
mvn -Pdefault,makeeclipse
|
Troubleshooting
If you're building the 2.0 branch and the build fails because it can't find an xbean jar (for example org.apache.xbean:xbean-naming:jar:3.2-r579367), then add the
No Format |
---|
http://svn.apache.org/repos/asf/openejb/repo/
|
repository to the pom.xml
file in the root of the source tree. See this messagefor more details.