I am using the following ant task to run Forrest from Eclipse, which works fine for me.
This task assumes Forrest 0.7 which has not been released yet, but a snapshot version can be downloaded from: http://svn.apache.org/snapshots/forrest.
For Forrest 0.6, the directory layout is a little bit different but its quite easy to adapt this script for 0.6.


<!--
Runs Forrest by executing java with the following command line arguments:
(as determined from the forrest shell script):


   The forrest script launches 'ant' with the following command line:

$FORREST_HOME/tools/ant/bin/ant -buildfile $FORREST_HOME/main/forrest.build.xml -Dbasedir=${basedir} -emacs

   Ant's 'java' exec line:
   -classpath "$FORREST_HOME/tools/ant/lib/ant-launcher.jar"
   -Dant.home="$FORREST_HOME/tools/ant"
   -Dant.library.dir="$FORREST_HOME/tools/ant/lib"
   org.apache.tools.ant.launch.Launcher
   -lib ":
       $FORREST_HOME/lib/endorsed/jakarta-bcel-20040329.jar:
       $FORREST_HOME/lib/endorsed/jakarta-regexp-1.3.jar:
       $FORREST_HOME/lib/endorsed/xalan-2.6.1-dev-20041008T0304.jar:
       $FORREST_HOME/lib/endorsed/xercesImpl-2.6.2.jar:
       $FORREST_HOME/lib/endorsed/xml-apis.jar"
   "-buildfile" "$FORREST_HOME/main/forrest.build.xml"
   "-Dbasedir=${basedir}"
   "-emacs"

Forking is necessary since Forrest uses some extra libraries which are not present in the standard ant installation.
-->
<target name="forrest">


   <property name="forrest.home" value="/opt/apache-forrest-0.7-dev" />
   <property name="forrest.target" value="site" />

<path id="forrest.classpath">
<pathelement path="${forrest.home}/tools/ant/lib/ant-launcher.jar"/>
</path>
<property name="forrest.class" value="org.apache.tools.ant.launch.Launcher"/>


   <path id="forrest.endorsed.dir">
       <fileset dir="${forrest.home}/lib/endorsed">
           <include name="*.jar"/>
       </fileset>
   </path>

   <java
       classpathref="forrest.classpath"
       classname="${forrest.class}"
       dir="${basedir}"
       fork="true">

       <jvmarg value="-Xmx256m"/>

<sysproperty key="forrest.home" value="${forrest.home}"/>
<sysproperty key="ant.home" value="${forrest.home}/tools/ant"/>
<sysproperty key="ant.library.dir" value="${forrest.home}/tools/ant/lib"/>
<sysproperty key="basedir" value="${basedir}"/>


       <arg value="-lib"/>
       <arg pathref="forrest.endorsed.dir"/>

       <arg value="-buildfile"/>
       <arg value="${forrest.home}/main/forrest.build.xml"/>
       <arg value="${forrest.target}"/>

       <arg value="-emacs"/>
   </java>

</target>

Regards,
Peter van de Hoef

Audun V. Nes wrote:

Hi

I am trying to get Forrest to work from within Eclipse 3.0.1 but
are having a few problems and wanted to hear if anyone has succesfully
set that up. Based on the chapter "Invoking Forrest from Ant" in
the Forrest docmentation, I have created the following Ant build file:

<project name="CCCP Website" default="post-build">

    <property environment="env"/>
    <property name="forrest.home" value="${env.FORREST_HOME}"/>
    <import file="${env.FORREST_HOME}/forrest.build.xml"/>

    <target name="post-build" depends="site">
      <echo>Building Forrest website</echo>
    </target>
</project>

The enviroment variable FORREST_HOME is correctly set in my system enviroment,
and I can build my site by running "forrest" from command line without problems.


I was not sure where to copy xml-commons-resolver-1.1.jar, but I though
eclipse/plugins/org.apache.ant_1.6.2/lib was the right location.
I also added xml-commons-resolver-1.1.jar to the Ant classpath in Eclipse.


But when I run the build.xml file from within Eclipse I get the following problem:

Buildfile: C:\app\eclipse\workspace\CCCP\forrest\build.xml
init-props:
[echo] Loading project specific properties from C:\app\eclipse\workspace\CCCP\forrest\forrest.properties
[echo] Loading user specific properties from C:\Documents and Settings\far2fish\forrest.properties
[echo] Loading default properties from C:\app\forrest\src\core\context\default-forrest.properties
[mkdir] Created dir: C:\app\eclipse\workspace\CCCP\forrest\build\tmp
echo-settings:
check-skin:
fetch-skins-descriptors:
fetch-skin:
unpack-skins:
init-skins:
init:
-prepare-classpath:
check-contentdir:
examine-proj:
validation-props:
validate-xdocs:
BUILD FAILED: C:\app\forrest\src\core\targets\validate.xml:143: Parser org.apache.crimson.parser.XMLReaderImpl doesn't recognize feature http://apache.org/xml/features/validation/dynamic
Total time: 1 second


best regards
Audun


Reply via email to