Date: 2004-12-28T04:42:01 Editor: TorstenSchlabach Wiki: Cocoon Wiki Page: LoadInEclipse URL: http://wiki.apache.org/cocoon/LoadInEclipse
no comment Change Log: ------------------------------------------------------------------------------ @@ -2,7 +2,19 @@ [http://www.eclipse.org Eclipse] is a wonderful IDE. But making an Eclipse project for Cocoon isn't a piece of cake given the number of source directories and libraries that compose Cocoon, especially in version 2.1. -To ease this, Cocoon's build system now has a target to create the Eclipse project files automatically. +To ease this, Cocoon's build system has a target to create the Eclipse project files automatically. But (at least as of Cocoon 2.1.5 and above) there are a number of issues to keep in mind as well. + +=== Eclipse and Ant === + +Eclipse comes with Ant built-in. This is commonly known as the "internal Ant". The Ant integration in Eclipse provides some nice features, such as an outline for build.xml files from which you can right-click on a target to build it. Unfortunately this does not work for building Cocoon sources in Eclipse. + +The reson for that is that the Cocoon build process relies on external targets in Ant which are compiled on-the-fly during the Cocoon build process. So if you build Cocoon from the command line using either {{build.bat}} (Windows) or {{build.sh}} (*ix) here is what is happening internally: + + * All existing ANT_HOME and CLASSPATH variables in the environment are put aside. + * A new classpath is constructed consisting of all .jar files in $COCOON_SRC/lib/endorsed. (and nothing else!) + * The Ant in the $COCOON_SRC/tools tree is called with this newly constructed classpath and the {{-Djava.endorsed.dirs=lib\endorsed}} option. The effect will be that Ant will run using the Xalan and Xerces implementations provided in the endorsed directory which are presumably newer and/or contain additional features over the corresponding API implemenations that come with the JDK. For more information on the "endorsed" mechanism in Java is, have a look at [http://java.sun.com/j2se/1.5.0/docs/guide/standards/index.html]. + + Here are the required steps: * run {{{build eclipse-project}}}: this creates the {{{.project}}} and {{{.classpath}}} files, @@ -21,14 +33,14 @@ ---- To run the Ant build from within Eclipse you have to add something like this to the build.xml: -{{{ - <!-- =========================================================== --> - <!-- Use the Eclipse compiler if we are running in eclipse --> - <!-- =========================================================== --> - - <target name="properties" if="eclipse.running"> - <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> - </target> +{{{ + <!-- =========================================================== --> + <!-- Use the Eclipse compiler if we are running in eclipse --> + <!-- =========================================================== --> + + <target name="properties" if="eclipse.running"> + <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> + </target> }}} ''Note'': Cocoon build system uses Ant 1.6, so calling the Ant build from an older Eclipse without Ant 1.6 does not work. You need a recent 3.0 milestone build of Eclipse - or you know how to replace your Ant version in your older Eclipse.
