Building the Coherence Incubator Projects

compared with
Current by Christer Fahlgren
on Mar 03, 2010 17:23.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
h3. Overview
Coherence Incubator projects use of Apache Ant (for build scripting) and the Apache Ivy (for dependency management). Consequently we recommend that you have both of these tools correctly installed and configured before you attempt to build one or more Coherence Incubator projects from source code.

Currently the Coherence Incubator projects require the following tool versions to build;
* Apache Ant 1.7+
* Apache Ivy 2.0+

(Note: The following references to "Eclipse" assume the "Ganymede" release - version 3.4+)

h3. Downloading Installing and Configuring Apache Ant
# Download the current version of Apache Ant (typically ant-current-bin.zip) from here: http://www.apache.org/dist/ant/
# Uncompress the downloaded file into a suitable folder (let's call this /your/path/to/ant)
# Set an environment variable called ANT_HOME in your system environment variables.
## For *nix bash-based shells (like Apple OS X), perform the following;
## Open ~/.profile with your favorite text editor.
## Add the following to the top of the file: export ANT_HOME=/your/path/to/ant
## Edit (or define) a PATH export to be as follows:
## export PATH=$ANT_HOME/bin:$PATH
## Save your .profile and exit your editor
## Execute the following shell command (in a Terminal Window) to re-read your new profile: source ~/.profile
## From a shell prompt (in a Terminal Window) you should now be able to execute the following command (from any path) to determine the version of Ant you have just installed: ant -version

h3. Configuring Eclipse to use the Apache Ant installation
If you're using Eclipse (or another IDE) it's recommended that you upgrade it to use the latest Apache Ant release you've just installed. Here's how:
# Open Eclipse
# Open the Preference Window
## On *nix-based releases of Eclipse (including Apple OS X), choose the Eclipse > Preferences menu.
## On Windows-based releases of Eclipse, choose the Window > Preferences menu.
# Choose Ant > Runtime
# Press the "Ant Home..." button
# Choose the location of /your/path/to/ant

h3. Downloading, Installing and Configuring Apache Ivy
# Download the latest version of Apache Ant Ivy (with dependencies) from here: http://www.apache.org/dist/ant/ivy/
# Uncompress the downloaded file into a suitable folder (let's call this /your/path/to/ivy)
# Copy the ivy-x.y.z.jar from /your/path/to/ivy into /your/path/to/ant/lib

h3. Configuring Eclipse to use the Apache Ivy installation
To dramatically simplify developing applications with the Coherence Incubator projects, or modifying the Coherence Incubator projects themselves, we recommend installing the IvyDE plug-in for Eclipse. This will eliminate the need to configure class, build or run-time paths for Coherence Incubator projects (as IvyDE will manage this for you).

Here's how to install the latest IvyDE plug-in for Eclipse:
# Open Eclipse
# Select Help > Software Updates...
# Select the "Available Software" tab
# Press the "Add Site..." button
# Set the Location to be: http://www.apache.org/dist/ant/ivyde/updatesite
# After a few seconds (as Eclipse downloads information about the plug-in), the "Apache IvyDE Eclipse plugins" software will appear in the list of available software.
# Check the box next to "Apache IvyDE Eclipse plugins"
# Press the "Install..." button and wait for the install to complete. You may need to restart Eclipse after the plug-in is installed to activate it.
# Reopen Eclipse
# Open the Preferences Window
# Select "Ivy" from the list of preferences
# In the panel "Classpath Container Configuration", select "Resolve Dependencies in Workspace"
# Press the "Apply" button
# Press the "OK" button

Alternatively if you have trouble you can follow the directions here: http://ant.apache.org/ivy/ivyde/download.cgi

h3. Preparing the Apache Ivy Repository
Apache Ivy keeps dependencies in "repositories" from which it can build class-paths for compilation and application execution. While most open source dependencies are available from public repositories (for example Maven2 repositories), some dependencies, like Coherence, are not published publically to such repositories and hence have to be manually installed into your local, enterprise or shared Apache Ivy repository.

The following sections outline the process of installing Coherence Incubator dependencies that are not available from public repositories (like Maven2).

h4. Publishing Coherence into the local Ivy repository
You can use the attached [^publish-coherence.xml] ant build script to publish your coherence distribution to your local ivy repository. You will also need a valid copy of a coherence distribution zip file. Take the following steps to publish coherence to your local ivy repository:
# Download the coherence distribution zip file
# Download publish-coherence.xml
# Make sure ANT is in your environment as specified above
# Run "ant -Dcoherence.version=3.4 -Dcoherence.build=405 -Dcoherence.location=$HOME/downloads -f publish-coherence.xml"

Once this script completes successfully ivy should be installed in your local ivy repository. The output should look like this:
{noformat}
publish:
[mkdir] Created dir: /Users/narliss/incubator/tools/trunk/bin/.tmp
[unzip] Expanding: /Users/narliss/dev/release/coherence-v3.4/dist/coherence-V3.4b405.zip into /Users/narliss/incubator/tools/trunk/bin/.tmp
No ivy:settings found for the default reference 'ivy.instance'. A default instance will be used
no settings file found, using default...
[ivy:info] :: Ivy 2.0.0 - 20090108225011 :: http://ant.apache.org/ivy/ ::
:: loading settings :: url = jar:file:/Users/narliss/incubator/tools/trunk/ant/lib/ivy-2.0.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:resolve] :: resolving dependencies :: oracle#coherence;3.4
[ivy:resolve] confs: [core]
[ivy:resolve] :: resolution report :: resolve 74ms :: artifacts dl 0ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| core | 0 | 0 | 0 | 0 || 0 | 0 |
---------------------------------------------------------------------
[ivy:publish] :: publishing :: oracle#coherence
[ivy:publish] published coherence to /Users/narliss/.ivy2/local/oracle/coherence/3.4/jars/coherence.jar
[ivy:publish] published tangosol to /Users/narliss/.ivy2/local/oracle/coherence/3.4/jars/tangosol.jar
[ivy:publish] published ivy to /Users/narliss/.ivy2/local/oracle/coherence/3.4/ivys/ivy.xml
{noformat}

h4. Building the Incubator projects
Once you have installed Ant, Ivy, and published Coherence to your local ivy repository you can build through eclipse, or the command line. To build from the command line run "ant" from the root directory of any given project.
{include:Building the Coherence Incubator Projects 1.1.0}