Prerequisites
Java Developer Kit (JDK)
You will need a JDK 1.4.2+ (J2SE 1.4.2+) or compatible JDK to build Groovy.
Apache Ant
To execute the build process you need to have Apache Ant version 1.7.0 (or newer) installed.
|
The optional TraX taskdefs are required, and some linux distributions, such as openSUSE, may require you to install them separately from the ant packages. |
Subversion Client
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.
|
If you are using a source archive from the distribution site site, then you do not need to have a Subversion client installed. |
Fetch the Groovy Source Code
From Subversion
There are many different protocols available to access the Groovy source code. For the complete list see the source repository details for the project.
svn co https://svn.codehaus.org/groovy/trunk/groovy/groovy-core
From a Source Archive
Select one of the *-src.* archives from the distribution site site and unzip it.
For example, to use the source from the Groovy 1.1-beta-2 release:
wget http://dist.groovy.codehaus.org/distributions/groovy-src-1.1-beta-2.zip unzip groovy-src-1.1-beta-2.zip
Preparing to Build for the First Time
If you are behind a proxy firewall, you may need to set up proxy information in a ~/.ant/settings.xml or ~/.m2/settings.xml file:
<?xml version="1.0"?>
<settings>
<proxies>
<proxy>
<protocol>http</protocol>
<host>proxy.host.net</host>
<port>8080</port>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>
</settings>
If you will need to publish artifacts then you will need to have appropriate permissions with codehaus and ensure that you have stored your credentials in a ~/.ant/settings.xml or ~/.m2/settings.xml file of the form:
<?xml version="1.0"?>
<settings>
<servers>
<server>
<id>codehaus.org</id>
<username>YOUR_USER_NAME</username>
<password>YOUR_PASSWORD</password>
</server>
</servers>
</settings>
Building
To build everything, run tests and create a complete installation in target/install, run:
ant install
| Useful Information In case of java.lang.OutOfMemoryError try increasing the size of the heap space by setting the ANT_OPTS variable as follows: ANT_OPTS=-Xmx512M Increase the size of the heap size if required. |
After this finished successfully, then you can try out the distribution that was just built. For example to play with groovysh you can run:
./target/install/bin/groovysh
Sometimes its desirable to skip the test execution for faster turn around. To turn off tests set the skipTests property, as in:
ant install -DskipTests=true
Distribution Archives
To build a Groovy distribution archive:
ant dist
This will build everything, generate documentation and create distribution archives under target/dist:
|
|
Publishing Artifacts
To publish artifacts to the Maven 2 repository, run:
ant deploy
This will either publish to the release repository or the snapshot repository based on whether the POM version contains SNAPSHOT or not.
If deploy is failing, then check Installing the UserTrust CA into the Java JDK.
Comments (1)
Jan 09, 2008
Jonathan Ruckwood says:
I experienced the following build failure concerning ant (version 1.7.0 compiled...I experienced the following build failure concerning ant (version 1.7.0 compiled on September 23 2007) and ANTLR on Mac OS Leopard (10.5):
BUILD FAILED /Users/jon_r/Documents/Projects/groovy-core/build.xml:65: Problem: failed to create task or type antlr Cause: the class org.apache.tools.ant.taskdefs.optional.ANTLR was not found. This looks like one of Ant's optional components. Action: Check that the appropriate optional JAR exists in -/usr/share/ant/lib -/Users/jon_r/.ant/lib -a directory added on the command line with the -lib argument Do not panic, this is a common problem. The commonest cause is a missing JAR. This is not a bug; it is a configuration problemThis problem can be solved quickly by following these steps:
After taking these steps your build should not fail with this error again. I hope someone else finds this information useful.