You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 144 Next »

Overview

This documents how to build the Apache Geronimo Server project.

This guide is intended to cover how to build the latest server/trunk, though other newer branches should also follow similar instructions. Server trees that use the same basic build tooling include:

  • server/trunk
  • server/branches/2.2
  • server/branches/2.1
  • server/branches/2.0
  • server/branches/1.2 (not tested recently)

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.

Java 6 works with trunk and 2.2. Earlier versions may have problems. Trunk is likely to require Java 6 soon.

Apache Maven 2

To execute the build process you need to have Apache Maven version 2.0.10 (or newer) installed.

To check if your installation is working and you have the required minimum version run:

mvn -version

And it should produce something like:

Maven version: 2.0.10

If you have an incompatible version the server build will probably fail with a message complaining (wink)

Subversion

To fetch the source code for the server, you will need to have a Subversion client version 1.5 (or newer, 1.5 is recommended) installed.

Windows 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:

<?xml version="1.0"?>
<settings>
    <localRepository>C:\.m2</localRepository>
</settings>

Checkout Geronimo

svn co https://svn.apache.org/repos/asf/geronimo/server/trunk server

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.

Windows 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.

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:

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.

# 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:

# Increase the heap and max permanent size for Maven
if [ "x$MAVEN_OPTS" = "x" ]; then
    MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"
fi

Windows 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:

set <VARIABLE>=<VALUE>

Building

To build all changes incrementally:

mvn install

To perform clean builds, which are sometimes needed after some changes to the source tree:

mvn clean install

Building Stages

In some cases you may need to build Geronimo in stages, such as when you have changed the geronimo version. Most users will not need to do this, but its documented here for clarity.

To build modules, testsupport and maven-plugins:

mvn install -Dstage=bootstrap

To build apps, configs and assemblies:

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.

Using Sonatype nexus can help make large maven builds faster and more reliable. However you have to configure all the repositories specified in the geronimo poms in your nexus instance.

Testing the Assembly

using the geronimo-maven-plugin

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:

mvn -Ptools geronimo:start

Windows Tip

Windows users may need to specify an alternative installDirectory to avoid long path problems:

mvn -Ptools geronimo:start -DinstallDirectory=c:\g

And to stop, either CTRL-C or from a separate terminal, from the project root directory run:

mvn -Ptools geronimo:stop

or by hand

cd assemblies/geronimo/jetty6-javaee5/target
tar xzf geronimo-jetty6-javaee5-<version>-bin.tar.gz
./geronimo-jetty-javaee5-<version>/bin/gsh geronimo/start-server

IDE Setup

The server project does not have any IDE files checked in since major IDEs have better support for maven than maven for them.

Intellij IDEA

For the IDEA 8.1 and later:
The project is too large to easily open at once in IDEA. Generally the framework project and individual plugins are a good size to work with. In the maven projects tab, check the it profile to get more of the maven projects.

Eclipse

Use the m2eclipse eclipse plugin. As for IDEA, opening framework or individual plugins is more likely to work than trying to open the whole project.

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

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.

  • No labels