Uploaded image for project: 'Forrest'
  1. Forrest
  2. FOR-471

Missing "--noconfig" causes NoClassDefFoundError due to ant sourcing external config files

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 0.6, 0.7
    • Fix Version/s: 0.7
    • Labels:
      None
    • Environment:
      Any system that already has an Ant installation with config files in the standard locations (/etc/ant.conf, $HOME/.ant/ant.conf, $HOME/.antrc).

      Description

      Forrest comes with a self-contained Ant distribution. In order for it to work properly, it is important to avoid picking up Ant config files that belong to other potentially existing Ant installations on the system. On Red Hat Linux, e.g., the RPM package for ant 1.5.2 installs /etc/ant.conf. When running Forrest 0.6 out of the box (e.g., "forrest -projecthelp"), the tools/ant/bin/ant script included with Forrest sources /etc/ant.conf and picks up an incorrect value for ANT_HOME (/usr/share/ant in this case). This results in a

      Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

      exception when trying to run forrest because there is no /usr/share/ant/lib/ant-launcher.jar. Even if there was, we wouldn't want to pick up those jars anyway, we want the ones that came with Forrest.

      The fix is to change line 95 (as of v0.6) in src/core/bin/forrest from

      "$ANT_HOME/bin/ant" -buildfile "$ANTFILE" -Dbasedir="$PROJECT_HOME" -Dforrest.home="$FORREST_DOT_HOME" -emacs $@

      to

      "$ANT_HOME/bin/ant" --noconfig -buildfile "$ANTFILE" -Dbasedir="$PROJECT_HOME" -Dforrest.home="$FORREST_DOT_HOME" -emacs $@

      This tells ant to ignore default config files, which is what we want in this case since the ant used by forrest is completely self-contained.

      As of 3-18-05, this bug is still present in the HEAD revision of the forrest startup script (since v0.7-dev known as bin/forrest).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rcalmbac Richard Calmbach
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: