Table of Contents

Overview

ant is needed to build Crossfire Editor also called gridarta.

This page contains various examples of setting up ant on different systems. Even if the platform you have is not shown here, the information could be helpful clues as to what might need to be installed on your system.

Examples

Mandriva

2009.0

x86_64

# urpmi –exclude-media “Mandriva Linux - 2009.0 (Free64) - Installer” ant

In order to satisfy the 'java-devel[>= 0:1.5.0]' dependency, one of the following packages is needed:
 1- java-1.6.0-openjdk-devel-1.6.0.0-0.16.b11.4mdv2009.0.x86_64: OpenJDK Development Environment (to install)
 2- java-1.5.0-gcj-devel-1.5.0.0-17.1.7mdv2009.0.x86_64: JPackage development scripts for GCJ (to install)
 3- kaffe-devel-1.1.8-1mdv2008.1.x86_64: Development package with static libs and headers for kaffe (to install)
What is your choice? (1-3) 1                                                    
To satisfy dependencies, the following packages are going to be installed:
   Package                        Version      Release       Arch
(medium "Main (Official2009.0-1)")
  ant                            1.7.1        7.0.1mdv2009> x86_64
  java-1.6.0-openjdk-devel       1.6.0.0      0.16.b11.4md> x86_64
  xalan-j2                       2.7.0        7.0.6mdv2009> noarch
  xerces-j2                      2.9.0        9mdv2009.0    x86_64
  xml-commons                    1.3.04       3.0.2mdv2009> x86_64
  xml-commons-jaxp-1.3-apis      1.3.04       3.0.2mdv2009> x86_64
  xml-commons-resolver12         1.3.04       3.0.2mdv2009> x86_64
50MB of additional disk space will be used.
13MB of packages will be retrieved.
Proceed with the installation of the 7 packages? (Y/n) y

# urpmi –exclude-media “Mandriva Linux - 2009.0 (Free64) - Installer” xml-commons-apis

In order to satisfy the 'xml-commons-jaxp-1.2-apis|xml-commons-jaxp-1.1-apis|xml-commons-jaxp-1.3-apis' dependency, one of the following packages is needed:
 1- xml-commons-jaxp-1.1-apis-1.3.04-3.0.2mdv2009.0.x86_64: JAXP 1.1, DOM2, SAX2, SAX2-ext 1.0 apis (to install)
 2- xml-commons-jaxp-1.2-apis-1.3.04-3.0.2mdv2009.0.x86_64: JAXP 1.2, DOM 2, SAX 2.0.1, SAX2-ext 1.0 apis (to install)
What is your choice? (1-2) 2

# urpmi –exclude-media “Mandriva Linux - 2009.0 (Free64) - Installer” ant-junit

To satisfy dependencies, the following packages are going to be installed:
   Package                        Version      Release       Arch
(medium "Main (Official2009.0-1)")
  ant-junit                      1.7.1        7.0.1mdv2009> x86_64
  junit                          3.8.2        5.0.1mdv2009> x86_64
1.4MB of additional disk space will be used.
501KB of packages will be retrieved.
Proceed with the installation of the 2 packages? (Y/n) y

# urpmi –exclude-media “Mandriva Linux - 2009.0 (Free64) - Installer” ant-nodeps

$ export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
$ export ANT_HOME=/usr/share/ant

2007.0

x86_64

Example Linux build environment setup and troubleshooting tips

This summary of a setup on an x86_64 Mandriva 2007.0 system may help identify some of the build environment setup issues that may crop up on a Linux system. The Mandriva distribution uses urpmi to manage RPM package installation.  Use the command appropriate to your particular distribution.  Packages required may vary, but the requirements for Mandriva 2007.0 are shown here to give a basic idea of what is needed.

  1. Unpack and install the JDK.  For example:<blockquote>

    $ sudo bash jdk-6u2-linux-amd64-rpm.bin

  2. Find out where the JDK was installed.

    $ rpm -ql jdk
    .
    .
    .
    $ ls -l /usr/java
    total 0
    lrwxrwxrwx 1 root root  16 Aug  4 13:54 default → /usr/java/latest/
    drwxr-xr-x 9 root root 448 Aug  4 13:54 jdk1.6.0_02/
    lrwxrwxrwx 1 root root  21 Aug  4 13:54 latest → /usr/java/jdk1.6.0_02/

  3. Put the newly installed Sun Java first in your run path by fixing the login profile and/or executing these export commands.

    $ export PATH=/usr/java/latest/bin;$PATH
    $ export JAVA_HOME=/usr/java/latest

    If the primary login shell is BASH, ~/.bash_profile is where to put these commands so that the changes persist across sessions.

  4. Install ant.

    $ sudo urpmi ant
    One of the following packages is needed:
    1- java-1.4.2-gcj-compat-devel-1.4.2.0-40.103.1mdv2007.0.x86_64 : JPacka…
    2- kaffe-devel-1.1.7-1mdk.x86_64 : Development package with static libs …\\  What is your choice? (1-2) 1
    One of the following packages is needed:
    1- xml-commons-resolver10-1.3.03-5.1mdv2007.0.x86_64 : XmlResolver 1.0 u…
    2- xml-commons-resolver11-1.3.03-5.1mdv2007.0.x86_64 : XmlResolver 1.1 u…
    3- xml-commons-resolver12-1.3.03-5.1mdv2007.0.x86_64 : XmlResolver 1.2 f…
    What is your choice? (1-3) 3
    To satisfy dependencies, the following packages are going to be installed
    ant-1.6.5-21mdv2007.0.x86_64
    antlr-2.7.6-4.1mdv2007.0.x86_64
    bouncycastle-1.33-3mdv2007.0.x86_64
    bouncycastle-jdk1.4-1.33-3mdv2007.0.x86_64
    classpath-0.92-3mdv2007.0.x86_64
    classpathx-jaf-1.1.1-1mdv2007.0.x86_64
    classpathx-mail-1.1.1-3mdv2007.0.x86_64
    classpathx-mail-monolithic-1.1.1-3mdv2007.0.x86_64
    eclipse-ecj-3.2.0-12.3mdv2007.0.x86_64
    gcc-java-4.1.1-3mdk.x86_64
    gcj-tools-4.1.1-3mdk.x86_64
    gjdoc-0.7.7-9mdv2007.0.x86_64
    jamvm-1.4.3-3.1mdv2007.0.x86_64
    java-1.4.2-gcj-compat-1.4.2.0-40.103.1mdv2007.0.x86_64
    java-1.4.2-gcj-compat-devel-1.4.2.0-40.103.1mdv2007.0.x86_64
    jikes-1.23-0.20050308.1mdk.x86_64
    jpackage-utils-1.7.0-1.4mdv2007.0.noarch
    lib64gcj7-devel-4.1.1-3mdk.x86_64
    xalan-j2-2.7.0-2.2mdv2007.0.x86_64
    xerces-j2-2.8.0-1mdv2007.0.x86_64
    xml-commons-1.3.03-5.1mdv2007.0.x86_64
    xml-commons-resolver12-1.3.03-5.1mdv2007.0.x86_64
    Proceed with the installation of the 22 packages? (84 MB) (Y/n) Y

  5. Install some additional packages.  Note, these were required for Crossfire's jxclient.  It has not been assured that they are required for the gridarta CrossfireEditor.

    $ sudo urpmi xml-commons-apis
    One of the following packages is needed:
    1- xml-commons-jaxp-1.1-apis-1.3.03-5.1mdv2007.0.x86_64 : JAXP 1.1, DOM2…
    2- xml-commons-jaxp-1.2-apis-1.3.03-5.1mdv2007.0.x86_64 : JAXP 1.2, DOM …
    3- xml-commons-jaxp-1.3-apis-1.3.03-5.1mdv2007.0.x86_64 : JAXP 1.3, DOM …
    What is your choice? (1-3) 3

    $ sudo urpmi ant-junit
    To satisfy dependencies, the following packages are going to be installed:
    ant-junit-1.6.5-21mdv2007.0.x86_64
    junit-3.8.2-1.1mdv2007.0.x86_64
    Proceed with the installation of the 2 packages? (2 MB) (Y/n) y

  6. Troubleshooting may be required.  Use –execdebug to identify some issues.
    Note the difference in output between the first and second commands.

    $ ant
    Exception in thread “main” java.lang.NoClassDefFoundError: org.apache.tools.ant.launch.Launcher at gnu.java.lang.MainThread.run(libgcj.so.7)
    Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher not found in gnu.gcj.runtime.SystemClassLoader{urls=[/usr/bin/build-classpath,/usr/lib/jvm/java-gcj/lib/tools.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[/usr/share/java-ext/bcprov-jdk14-1.33.jar], parent=null}
    }
    at java.net.URLClassLoader.findClass(libgcj.so.7)
    at java.lang.ClassLoader.loadClass(libgcj.so.7)
    at java.lang.ClassLoader.loadClass(libgcj.so.7)
    at java.lang.Class.forName(libgcj.so.7)
    at gnu.java.lang.MainThread.run(libgcj.so.7)

    $ ant –execdebug
    exec “/usr/java/latest/jre/bin/java” -classpath “/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/java/latest/lib/tools.jar” -Dant.home=“/usr/share/ant” -Dant.library.dir=“/usr/share/ant/lib” org.apache.tools.ant.launch.Launcher -cp ““
    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

    For some reason, something is looking for the directory /usr/lib/java-1.6.0.
    Oddly, all that is needed in this case is to create the directory.

    $ sudo mkdir /usr/lib/java-1.6.0

  7. Install dependencies over and above requirements for jxclient.

    $ ant –execdebug
    exec ”/usr/java/latest/jre/bin/java” -classpath “/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/java/latest/lib/tools.jar” -Dant.home=“/usr/share/ant” -Dant.library.dir=“/usr/share/ant/lib” org.apache.tools.ant.launch.Launcher -cp ““
    Buildfile: build.xml

    init:

    BUILD FAILED
    /home/data/svn/gridarta/crossfire/build.xml:66: Could not create task or type of type: echoproperties.

    Ant could not find the task or a class this task relies upon.

    This is common and has a number of causes; the usual solutions are to read the manual pages then download and install needed JAR files, or fix the build file:
    - You have misspelt 'echoproperties'.
    Fix: check your spelling.
    - The task needs an external JAR file to execute and this is not found at the right place in the classpath.
    Fix: check the documentation for dependencies.
    Fix: declare the task.
    - The task is an Ant optional task and the JAR file and/or libraries implementing the functionality were not found at the time you yourself built your installation of Ant from the Ant sources.
    Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the task and make sure it contains more than merely a META-INF/MANIFEST.MF.
    If all it contains is the manifest, then rebuild Ant with the needed libraries present in ${ant.home}/lib/optional/ , or alternatively, download a pre-built release version from apache.org
    - The build file was written for a later version of Ant
    Fix: upgrade to at least the latest release version of Ant
    - The task is not an Ant core or optional task and needs to be declared using <taskdef>.
    - You are attempting to use a task defined using <presetdef> or <macrodef> but have spelt wrong or not defined it at the point of use

    Remember that for JAR files to be visible to Ant tasks implemented in ANT_HOME/lib, the files must be in the same directory or on the classpath

    Please neither file bug reports on this problem, nor email the Ant mailing lists, until all of these causes have been explored, as this is not an Ant bug.

    Total time: 0 seconds

    $ sudo urpmi ant-nodeps

  8. Build the application.

    $ ant
    Buildfile: build.xml

    init:

    clean:
    [mkdir] Created dir: /home/data/svn/gridarta/crossfire/class/production

    ctags:

    compile:
    [javac] Compiling 309 source files to /home/data/svn/gridarta/crossfire/class/production

    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 25 warnings

    jar:
    [jar] Building jar: /home/data/svn/gridarta/crossfire/CrossfireEditor.jar
    [delete] Deleting directory /home/data/svn/gridarta/crossfire/class/production

    BUILD SUCCESSFUL
    Total time: 11 seconds

  9. Run the application.

    $ java -jar CrossfireEditor.jar