Date: 2004-12-28T05:03:27
Editor: TorstenSchlabach
Wiki: Cocoon Wiki
Page: LoadInEclipse
URL: http://wiki.apache.org/cocoon/LoadInEclipse
no comment
Change Log:
------------------------------------------------------------------------------
@@ -8,13 +8,50 @@
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:
+The reson for that is that the Cocoon build process relies on external tasks
in Ant (see: [http://ant.apache.org/external.html]) 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].
+One of the very first targets in the build process is the {{init-tasks}}
target in the file {{tools/targets/init-build.xml}}. This target will compile
the external Ant tasks
+ * xpatch (what is says)
+ * jing (RELAX NG validation)
+ * sitemap-components
+
+from the sources in {{tools/src/anttasks}} to {{tools/anttasks}} and make
these external tasks known to Ant using {{<taskdef ...>}}.
+
+Other targets further down the build process rely on these tasks obviously.
+
+==== Why does that not work with the internal Ant in Eclipse ====
+
+----
+
+Quite frankly: Don't know yet. Whoever is sure about this is strongly
encouraged to edit this section or - even better - explain how to make it work.
All I was able to speculate about so far is:
+
+ * I am not sure to what extend the CLASSPATH manipulation done in the
build.bat / build.sh scripts can be done with Eclipse internal Ant but at the
same time it am not sure if it will be necessary at all.
+ * There seems to be no hook in the Eclipse UI to specify the endorsed lib
directory for the Ant run.
+ * The internal Ant is running in the same VM as the Eclipse workbench itself.
So I don't consider it an option to alter the endorsed settings through the
-vmargs option when starting the Eclipse workbench.
+
+It is not the reason:
+
+ * ... that Ant version in Cocoon and Eclipse do not match! Both Cocoon 2.1.6
and Eclipse 3.1 M3 come with Ant 1.6.2!
+
+Questions and places to discuss:
+
+ * Why does the Cocoon build process has to build the external Ant tasks from
source rather than supplying them as .class / .jar files? (We don't build Ant
itself from source, do we? Should we?) This would be a topic for the Cocoon
Developer's list.
+ * Should the "internal Ant" run in a separate VM or use a separate class
loader? Does it already have this capability and I just overlooked it? Should
there be an option to specify endorsed libraries for the Ant run? This would be
a topic for the Ant integration list at the Eclipse Platform project.
+
+I will raise these questions in the mentioned places and update this page as
soon as I get any answers.
+
+TorstenSchlabach
+
+----
+
+=== Building Cocoon using Eclipse internal Ant ===
+
+{{{ broken at least for 2.1.5 and above, see above }}}
Here are the required steps:
* run {{{build eclipse-project}}}: this creates the {{{.project}}} and
{{{.classpath}}} files,