Author: reinhard
Date: Wed Feb  2 01:26:44 2005
New Revision: 149502

URL: http://svn.apache.org/viewcvs?view=rev&rev=149502
Log:
document about 'How to build Cocoon projects using Ant - Cocoon 2.1.X' by Helma 
van der Linden, issue 33334

Added:
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/content_en.html
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/build-cocoon-targets.xml
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.png
   (with props)
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.psd
   (with props)
    
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/meta.xml

Added: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/content_en.html
URL: 
http://svn.apache.org/viewcvs/cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/content_en.html?view=auto&rev=149502
==============================================================================
--- 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/content_en.html
 (added)
+++ 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/content_en.html
 Wed Feb  2 01:26:44 2005
@@ -0,0 +1,218 @@
+<?xml version="1.0"?>
+<html>
+<head>
+<title>Building your own Cocoon project using Ant</title>
+</head>
+<body>
+<h1>Building your own Cocoon project using Ant</h1>
+<p>
+Now that you've studied Cocoon and you are convinced it is worth 
+spending your time on, you want to try your hand at your own project.
+There are several ways to start your own project. This is just one of them.
+</p>
+<p>
+The following HOW-TO helps you to create your own project in a subdirectory of 
the Cocoon root. 
+It also has its own subsitemap.
+The main advantage of this configuration is the fact that you can leave the 
original Cocoon 
+root sitemap intact. 
+Since it is set up in a pretty generic way and accommodating most types of 
generators, 
+transformers and serializers, it provides a working environment that you don't 
have to understand 
+thoroughly before you are able to use it. Instead, you can work the other way 
around. Once you 
+understand a part of the root sitemap you can tune it to your needs.
+</p>
+<p>
+Another advantage of this configuration is the strict separation of the files 
that are part of 
+Cocoon and those that are part of your project. The separation allows you to 
update Cocoon without 
+overwriting vital modifications. Or you can develop your webapp against 
different Cocoon 
+distributions.
+<br/>
+<b>Note:</b> This configuration will work with Cocoon 2.1.X distributions and 
maybe more recent.
+It will probably be more difficult to get this working with an older 
distribution.
+</p>
+
+<h2>Initial setup</h2>
+<p>
+The following steps explain how to set up this configuration. These steps will 
only be performed once. 
+You will work from the commandline.
+</p>
+<ol>
+<li>Get the Cocoon distribution. You can either download a release build or 
dive in and get the latest HEAD from SVN.</li>
+<li>Make a separate project directory and put <i>build-cocoon-targets.xml</i> 
in this directory.</li>
+<li>&quot;Seed&quot; the project by running the following on the commandline:
+<pre>ant -f build-cocoon-targets.xml 
-Dcocoon.distro.home=/path/to/your/cocoon/distribution</pre></li>
+<p>
+<b>Note:</b> Either you have ANT_HOME set to the appropriate directory or you 
use the full path to Ant.<br/>
+<b>Note:</b> The <i>cocoon.distro.home</i> is now set in 
<i>user.properties</i>.<br/>
+<b>Note for Windows users:</b> set the slashes as forward slashes.</p>
+<li>Customize the <i>src/cocoon/local.build.properties</i> and remove the 
+path variables in this file. Ant cannot substitute variables in property 
files, 
+so ${...} variables would cause build errors. 
+Remove the sections <i>build, build webapp, src, standalone demo, dir layout, 
tools, 
+deprecated, ide, lib, dist, site, legal, gump</i>, so that there are no more 
${...} and variables in this file.</li>
+<li>Exclude all blocks you don't need in the top part of 
<i>local.build.properties</i>.</li>
+<li>Exclude the samples and documentation too if you don't need them. The 
build process is time consuming.</li>
+<li>Run the following command from the commandline:
+<pre>ant cocoon:get</pre>
+<b>Note:</b>This will only be done when changing the distribution or the 
settings in <i>local.build.properties</i>.</li>
+
+<li>Run the following command from the commandline:
+<pre>ant webapp</pre>
+This builds the Java classes and copies the entire project to the tools 
tree.<br/>
+<b>Note:</b> classes are built with <i>debug</i> flag on.</li>
+<li>Run the following command from the commandline:
+<pre>ant cocoon:run</pre>
+This starts Jetty with Cocoon and your project in it.<br/>
+<b>Note:</b> Default Cocoon is configured to automatically reload files that 
are changed. 
+This way Jetty can keep running while you develop your project. You only have 
to restart when the previous step
+has done any of the following:
+<ul>
+<li>changed any of the libraries,</li>
+<li>compiled java classes.</li>
+</ul>
+</li>
+<li>Start up your favourite browser and enter the following:
+<pre>http://localhost:8888/</pre>
+You should now see the homepage of Cocoon.</li>
+<li>Check your (now still empty) project in in your CVS.</li>
+</ol>
+<p>
+This concludes the initial setup.
+</p>
+<h3>Example</h3>
+<p>If we execute the above steps on a Windows machine with the Cocoon 
distribution in 
+/SVN/cocoon and your project in /projects/myprojects, the 
+commands and the resulting information on your screen will look like this:
+</p>
+<pre>
+D:\projects>mkdir myproject
+
+D:\projects>copy build-cocoon-targets.xml myproject
+        1 file(s) copied.
+
+D:\projects>cd myproject
+
+D:\projects\myproject>\apache-ant-1.6.1\bin\ant -f build-cocoon-targets.xml 
-Dcocoon.distro.home=/SVN/cocoon
+Buildfile: build-cocoon-targets.xml
+
+seed-check:
+
+msg-seed-localprops:
+
+seed-dirs:
+    [mkdir] Created dir: D:\projects\myproject\src\cocoon
+    [mkdir] Created dir: D:\projects\myproject\src\cocoon\webapp
+    [mkdir] Created dir: D:\projects\myproject\src\cocoon\xconf
+    [mkdir] Created dir: D:\projects\myproject\tools\cocoon
+    [mkdir] Created dir: D:\projects\myproject\tools\cocoon\webapp
+    [mkdir] Created dir: D:\projects\myproject\src\java
+    [mkdir] Created dir: D:\projects\myproject\lib
+
+seed-localprops:
+
+msg-seed-cvsignore:
+
+seed-cvsignore:
+
+msg-seed-userprops:
+
+seed-userprops:
+
+msg-seed-build:
+
+seed-build:
+     [echo] Creating build.xml...
+
+seed:
+     [echo] Done.
+     [echo]
+     [echo]     The directory src/cocoon/webapp is created to hold your cocoon
+     [echo]     webapp resources.
+     [echo]     The directory src/cocoon/xconf is created to hold XConfPatch 
files
+     [echo]     to (optionally) modify the cocoon.xconf log.xconf web.xml and
+     [echo]     (root) sitemap.xmap
+     [echo]
+     [echo]     From here:
+     [echo]     ---------
+     [echo]     You should now edit the file 
./src/cocoon/local.build.properties to select
+     [echo]     only those optional components of Cocoon that your project 
needs.
+     [echo]     IMPORTANT: Remove the path-entries from that file!
+     [echo]
+     [echo]     The build.xml can freely be extended for your project needs.
+     [echo]
+     [echo]     To build a fresh Cocoon base for this project
+     [echo]     (when you updated the distro pointed to by 
-Dcocoon.distro.home)
+
+     [echo]         > ant cocoon:get
+     [echo]
+     [echo]     To blend in your own project resources and classes:
+     [echo]         > ant webapp
+     [echo]
+     [echo]     To test-run using the Jetty container:
+     [echo]         > ant cocoon:run
+     [echo]
+
+BUILD SUCCESSFUL
+Total time: 1 second
+D:\projects\myproject>
+</pre>
+
+<h2>Directory layout</h2>
+<table style="border: 1px solid black">
+<tr><td><img src="files/dirlayout.png" /><br/>
+<i>Figure 1: Directory layout</i>
+</td></tr></table>
+<p>
+In figure 1 you can see the resulting directory layout. We'll discuss what 
each of these entries contain:
+<ul>
+<li><b>lib</b> This directory contains project dependant jars. Not the Cocoon 
jars, 
+since they are distribution dependent.</li>
+<li><b>src/java</b> Your own Java classes and components go here.</li>
+<li><b>src/cocoon/webapp</b> Add a directory &lt;yourProjectName&gt; here. 
This contains your
+Cocoon related files such as the sitemap, XSL and XML files.</li>
+<li><b>src/cocoon/xconf</b> Your modifications to the Cocoon configuration 
files go here.<br/>
+<b>Note:</b> See <!--<a href="xpatchusage">-->xpatchusage<!--/a--> for an 
explanation of how to create these modifications.
+</li>
+<li><b>tools/cocoon/webapp</b> This will contain the resulting structure for 
Jetty to display. 
+The Cocoon jars, copied from the Cocoon distribution are put here too in 
<i>WEB-INF/lib</i>.</li>
+<li><b>build.xml</b> This will be your Ant buildfile. Modify it to your 
needs.</li>
+<li><b>user.properties</b> and <b>src/cocoon/local.build.properties</b> 
contain some variables
+such as cocoon.distro.home</li>
+</ul> 
+<h2>During development</h2>
+<p>
+The <i>build.xml</i> contains several useful targets, which we will explain 
below. <b>Note</b> that
+this file includes <i>build-cocoon-targets.xml</i>. Some of the targets below 
are in that file, so
+don't delete it!
+</p>
+<ul>
+<li><b>cocoon:get</b> Get Cocoon into your project. This target will compile 
the Cocoon 
+distribution using your <i>local.build.properties</i> and put the result in 
+<i>tools/cocoon/webapp</i>.</li>
+<li><b>cocoon:unpatch</b> During <i>cocoon:get</i> the original versions of 
vital Cocoon configuration
+files such as <i>sitemap.xmap, cocoon.xconf, web.xml</i> and <i>logkit.xml</i> 
are copied to
+<i>tools/cocoon/unpatched</i>. This target allows you to copy the original 
versions to their
+respective locations. Very convenient when you changed an xconf file that 
cannot be applied.</li>
+<li><b>webapp</b> Compile the Java classes in <i>src/java</i> and copy the 
relevant files in the
+source tree to the appropriate places under <i>tools/cocoon</i>. It also 
modifies the Cocoon
+configuration files using the xconf files.</li>
+<li><b>cocoon:run</b> Start up Jetty with your webapp. Your project can be 
reached under
+<pre>http://localhost:8888/yourProjectName</pre></li>
+</ul>
+
+<p>
+The <i>build-cocoon-targets.xml</i> file can be found <a 
href="files/build-cocoon-targets.xml">here</a>. <br/>
+<i>Credits go to Marc Portier for the content and the Ant build script.</i>
+</p>
+
+<h2>ToDo</h2>
+<ul>
+<li>figure out the difference between the Ant 1.5 setup and the Ant 1.6 setup. 
OTOH: is this still necessary?</li>
+<li>check English (grammar, style, US vs EN)</li>
+<li>check if all is (still) accurate -&gt; it was as far as I can tell. </li>
+<li>Refer to this for adding it to Eclipse?</li>
+<li>create xpatchusage documentation</li>
+</ul>
+
+</body>
+</html>
+

Added: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/build-cocoon-targets.xml
URL: 
http://svn.apache.org/viewcvs/cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/build-cocoon-targets.xml?view=auto&rev=149502
==============================================================================
--- 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/build-cocoon-targets.xml
 (added)
+++ 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/build-cocoon-targets.xml
 Wed Feb  2 01:26:44 2005
@@ -0,0 +1,455 @@
+<?xml version="1.0"?>
+<!--
+This Apache Ant build.xml snippet contains targets for helping out 
+managing the Cocoon dependencies of your project.
+It assumes that you have Ant version 1.6.x or later that supports the 
+<import> task.
+
+Usage: [full automatic, for fresh projects starts]
+1) Copy this file to the root of your project
+   (e.g. to ./build-cocoon.targets.xml)
+2) ant -buildfile build-cocoon-targets.xml 
-Dcocoon.distro.home=/...abs_path_to_cocoon_src_distro...
+
+  this will generate a typical directory-structure containing:
+  ./build.xml  (minimal version to be completed to project needs)
+  ./user.properties (ready pointing to cocoon.distro.home)
+  ./src/cocoon/local.build.properties
+  ./src/cocoon/webapp
+  ./src/cocoon/xconf
+  .cvsignore (ignoring build and tools/cocoon/*)
+  
+  You manually start changing these as you go allong with your project.
+
+  The script will not overwrite files that already exist.
+
+Usage: [manual, for existing build.xml files]
+1) Copy this file to the root of your project
+   (e.g. to ./build-cocoon.targets.xml)
+2) Add the following to the top-level of your project's Ant build.xml script 
(possibly adjusting the path):
+   
+   <property name="cocoon.targets" value="./build-cocoon.targets.xml">
+   <import file="${cocoon.targets}">
+
+3) Add in various properties assumed to be available (change the paths to your 
own liking)
+
+   <property file="user.properties">
+   <property name="src" value="./src" />
+   <property name="src.cocoon" value="${src}/cocoon" />
+   <property name="cocoon.build.properties" 
value="${src.cocoon}/local.build.properties">
+   <property name="cocoon.xconf.dir" value="${src.cocoon}/xconf">
+   <property name="cocoon.tool.dir" value="tools/cocoon">
+
+
+How it works:
+
+All targets in this build file snippet depend upon 
+the following properties being set
+  1. cocoon.distro.home
+       location of src distribution of cocoon to use
+  2. cocoon.build.properties
+       property file with specific cocoon build settings
+       (selecting which blocks, samples,...)
+       typically src/cocoon/local.build.properties
+  3. cocoon.xconf.dir
+       location where the appropriate patch files can be found
+       typically src/cocoon/xconf
+  4. cocoon.tool.dir
+       where cocoon is build inside your project
+       typically this is tools/cocoon
+
+Updates and Background:
+http://wiki.cocoondev.org/Wiki.jsp?page=YourCocoonBasedProject
+-->
+<project name="YourCocoonBasedProject" default="seed" >
+
+  <!-- if not set yet... -->
+  <property file="user.properties" />
+  <property name="src" value="./src" />
+  <property name="src.cocoon" value="${src}/cocoon" />
+  <property name="cocoon.build.properties" 
value="${src.cocoon}/local.build.properties" />
+  <property name="cocoon.xconf.dir" value="${src.cocoon}/xconf" />
+  <property name="cocoon.tool.dir" value="tools/cocoon" />
+  <property name="cocoon.unpatched" value="${cocoon.tool.dir}/unpatched"/>
+
+  <!--
+    sets some essential properties for these targets
+  --> 
+  <target name="-cocoon:init">
+    <mkdir dir="${cocoon.tool.dir}" />
+    <property name="cocoon.webapp" value="${cocoon.tool.dir}/webapp" />
+    <property name="cocoon.tasks" value="${cocoon.tool.dir}/taskdefs" />
+    <property name="cocoon.lib" value="${cocoon.webapp}/WEB-INF/lib" />    
+  </target>
+
+  <!--
+    checks what kind of OS this is running on
+  -->
+  <target name="-cocoon:oscheck" >
+    <condition property="isWindows">
+      <os family="windows" />
+    </condition>
+  </target>
+    
+  <!--
+    creates Windows batch files for cocoon dependencies
+  -->
+  <target name="-cocoon:bat" if="isWindows"
+          depends="-cocoon:init, -cocoon:oscheck" >
+    <echo>Building batch files for support on windows OS</echo>
+    <property name="shbat" value="bat" />
+
+    <echo file="${cocoon.tool.dir}/getc2.${shbat}"><[EMAIL PROTECTED] off 
+if "%COCOON_HOME%"=="" then echo You haven't set the COCOON_HOME environment 
variable.
+echo GOING TO %COCOON_HOME%
+cd /d %COCOON_HOME%
+echo Running build.bat -propertyfile %PROJECT_PROPERTIES% clean webapp 
-Dbuild.webapp=%PROJECT_WEBAPP% -Dtools.tasks.dest=%PROJECT_TASKDEFS%
+build.bat -propertyfile %PROJECT_PROPERTIES% clean webapp 
-Dbuild.webapp=%PROJECT_WEBAPP% -Dtools.tasks.dest=%PROJECT_TASKDEFS% 
+]]></echo>
+
+    <echo file="${cocoon.tool.dir}/runc2.${shbat}"><[EMAIL PROTECTED] off
+set JETTY_WEBAPP=%PROJECT_WEBAPP%
+cd /d %COCOON_HOME%
+cocoon.bat servlet-debug
+]]></echo>
+  </target>
+
+  <!--
+    creates shell scripts for cocoon dependencies
+  -->
+  <target name="-cocoon:sh" unless="isWindows"
+          depends="-cocoon:init, -cocoon:oscheck" >
+
+    <echo>Building shell scripts for support on non-windows</echo>
+    <property name="shbat" value="sh" />
+
+    <echo file="${cocoon.tool.dir}/getc2.${shbat}"><![CDATA[#!/bin/sh
+cd $COCOON_HOME
+echo running /build.sh -propertyfile $PROJECT_PROPERTIES clean webapp 
-Dbuild.webapp=$PROJECT_WEBAPP -Dtools.tasks.dest=$PROJECT_TASKDEFS
+./build.sh -propertyfile $PROJECT_PROPERTIES clean webapp 
-Dbuild.webapp=$PROJECT_WEBAPP -Dtools.tasks.dest=$PROJECT_TASKDEFS
+]]></echo>
+       <chmod file="${cocoon.tool.dir}/getc2.${shbat}" perm="u+x"/>
+
+    <echo file="${cocoon.tool.dir}/runc2.${shbat}"><![CDATA[#!/bin/sh
+export COCOON_WEBAPP_HOME=$PROJECT_WEBAPP
+echo COCOON_WEBAPP_HOME=$COCOON_WEBAPP_HOME
+cd $COCOON_HOME
+./cocoon.sh servlet-debug
+]]></echo>
+        <chmod file="${cocoon.tool.dir}/runc2.${shbat}" perm="u+x"/>
+    </target>    
+
+  <!--
+    creates as needed batch files or shell scripts
+  -->
+  <target name="-cocoon:shbat" depends="-cocoon:bat, -cocoon:sh" />
+
+  <!--
+    checks if the cocoon dependency is holding what we expect 
+    sets a variable if all is ok
+  -->
+  <target name="-cocoon:test" depends="-cocoon:init">
+    <condition property="cocoon.ok" value="true">
+      <and>
+        <available type="dir" file="${cocoon.lib}" />
+        <available classname="XConfToolTask" 
+                   classpath="${cocoon.tasks}"/>
+      </and>
+    </condition>
+  </target>
+
+  <!--
+    fails the build if the cocoon dependency is not met
+  -->
+  <target name="-cocoon:check" depends="-cocoon:test" unless="cocoon.ok">
+    <fail>No cocoon available. Run 'ant cocoon.get' first.</fail>
+  </target>
+
+
+  <target name="-cocoon:patch">
+    <echo>Patching ${cocoon.patch.target} with 
+${cocoon.xconf.dir}/*.${cocoon.patch.src-extension} ...</echo>
+    <xpatch 
+      file="${cocoon.patch.target}"
+      srcdir="${cocoon.xconf.dir}" 
+      includes="**/*.${cocoon.patch.src-extension}"/>
+    </target>
+
+  <!-- 
+      applies the patch files in the ${cocoon.xconf.dir} 
+      on the various cocoon conf files
+  -->
+  <target name="cocoon:xconf" depends="-cocoon:check">
+    <path id="cocoon.tasks.cp">
+      <pathelement path="${cocoon.tasks}" />
+      <path>
+        <fileset dir="${cocoon.lib}">
+          <include name="xalan*.jar" />
+          <include name="xerces*.jar" />
+          <include name="xml*.jar" />
+        </fileset>
+      </path>
+    </path>
+
+    <taskdef 
+        name="xpatch" 
+        classname="XConfToolTask" 
+        classpathref="cocoon.tasks.cp"/>  
+
+    <xpatch file="${cocoon.webapp}/WEB-INF/cocoon.xconf" srcdir="">
+      <include name="${cocoon.xconf.dir}/*.xconf"/>
+    </xpatch>
+
+    <antcall target="-cocoon:patch" >
+      <param name="cocoon.patch.target" 
+           value="${cocoon.webapp}/WEB-INF/cocoon.xconf" />
+      <param name="cocoon.patch.src-extension" 
+           value="xconf" />
+    </antcall>
+
+    <antcall target="-cocoon:patch" >
+      <param name="cocoon.patch.target" 
+           value="${cocoon.webapp}/WEB-INF/logkit.xconf" />
+      <param name="cocoon.patch.src-extension" 
+           value="xlog" />
+    </antcall>
+
+    <antcall target="-cocoon:patch" >
+      <param name="cocoon.patch.target" 
+           value="${cocoon.webapp}/sitemap.xmap" />
+      <param name="cocoon.patch.src-extension" 
+           value="xmap" />
+    </antcall>
+
+    <antcall target="-cocoon:patch" >
+      <param name="cocoon.patch.target" 
+           value="${cocoon.webapp}/WEB-INF/web.xml" />
+      <param name="cocoon.patch.src-extension" 
+           value="xweb" />
+    </antcall>
+  </target>
+
+  <target name="cocoon:unpatch">
+    <copy todir="${cocoon.webapp}" overwrite="true" >
+      <fileset dir="${cocoon.unpatched}">
+        <include name="WEB-INF/web.xml" />
+        <include name="WEB-INF/cocoon.xconf" />
+        <include name="WEB-INF/logkit.xconf" />
+        <include name="sitemap.xmap" />
+      </fileset>
+    </copy>
+  </target>
+
+  <target name="cocoon:get" depends="-cocoon:shbat" description="Get cocoon 
into this project">
+      <mkdir dir="${cocoon.webapp}" />
+      <exec executable="${cocoon.tool.dir}/getc2.${shbat}" >
+        <env key="COCOON_HOME" file="${cocoon.distro.home}" />
+        <env key="PROJECT_PROPERTIES" file="${cocoon.build.properties}" />
+        <env key="PROJECT_WEBAPP" file="${cocoon.webapp}" />
+        <env key="PROJECT_TASKDEFS" file="${cocoon.tasks}" />
+      </exec>
+      <mkdir dir="${cocoon.unpatched}" />
+      <copy todir="${cocoon.unpatched}">
+        <fileset dir="${cocoon.webapp}" >
+          <include name="WEB-INF/web.xml" />
+          <include name="WEB-INF/cocoon.xconf" />
+          <include name="WEB-INF/logkit.xconf" />
+          <include name="sitemap.xmap" />
+        </fileset>
+      </copy>
+  </target>
+
+  <target name="cocoon:run" depends="-cocoon:shbat, -cocoon:check" 
description="Run cocoon on the built-in jetty to test">
+      <exec executable="${cocoon.tool.dir}/runc2.${shbat}" >
+        <env key="COCOON_HOME" file="${cocoon.distro.home}" />
+        <env key="PROJECT_WEBAPP" file="${cocoon.webapp}" />
+      </exec>
+  </target>
+
+
+  <!-- 
+  Below are some targets that build a default project-setting which allows you 
to 
+  make use of the reusable targets declared in this build-script.
+
+  You can launch the 'seed' target to start-off your project.
+  -->
+  <target name="seed-check">
+    <available property="cocoonHomeOk" file="${cocoon.distro.home}" />
+    <fail unless="cocoonHomeOk" >
+    This script needs a property $${cocoon.distro.home} to be set and 
+    pointing to an existing directory containing a cocoon 2.1.x distro.
+    You can set it either by providing a -D flag to ant, or 
+    by adding it to a local ./user.properties.
+    </fail>
+
+    <available property="existsBuild" file="build.xml" />
+    <available property="existsLocalProps" file="${cocoon.build.properties}" />
+    <available property="existsUserProps" file="user.properties" />
+    <available property="existsCvsIgnore" file=".cvsignore" />
+  </target>
+
+  <target name="msg-seed-build" if="existsBuild">
+    <echo>build.xml exists. This script cannot overwrite it.
+    If you want to regenerate the build.xml then manually delete it prior to 
running the seed target again.</echo>
+  </target>
+
+  <target name="seed-build" depends="msg-seed-build" unless="existsBuild">
+    <echo>Creating build.xml...</echo>
+    <echo file="build.xml"><![CDATA[<?xml version="1.0"?>
+<!-- 
+  File automatically generated by ant script for YourCocoonBasedProject.
+  Manually extend it to your own needs.
+  -->
+<project name="YourProjectName" default="init">
+  <property file="user.properties" />
+
+  <property name="src"              value="src" />
+  <property name="src.java"         value="${src}/java" />
+  <property name="src.cocoon"       value="${src}/cocoon" />
+  <property name="src.webapp"       value="${src.cocoon}/webapp" />
+  
+  <property name="build"            value="build" />
+  <property name="build.classes"    value="${build}/classes" />
+  <property name="zipfile"          value="${build}/${ant.project.name}.zip" />
+  <property name="warfile"          value="${build}/${ant.project.name}.war" />
+
+  <property name="lib"            value="lib" />
+
+  <property name="cocoon-build.properties" 
value="${src.cocoon}/local.build.properties" />
+  <property name="cocoon-xconf.dir" value="${src.cocoon}/xconf" />
+  <property name="cocoon-tool.dir"  value="tools/cocoon" />
+  <property name="cocoon.webapp"    value="${cocoon-tool.dir}/webapp" />
+  <property name="cocoon.lib"       value="${cocoon.webapp}/WEB-INF/lib" />
+  <property name="cocoon.classes"   value="${cocoon.webapp}/WEB-INF/classes" />
+
+  <property name="cocoon-targets" value="${ant.file}" />
+  <!-- insert properties here to override defaults in the import 
cocoon-targets script -->
+  <import file="$${cocoon-targets}" />
+
+  <path id="all.cp">
+    <pathelement location="${build.classes}" />
+    <fileset dir="${cocoon.lib}">
+      <include name="*.jar"/>
+    </fileset>
+    <fileset dir="${lib}">
+      <include name="*.jar"/>
+    </fileset>
+  </path>
+  
+  <target name="init">
+    <mkdir dir="${build.classes}" />
+  </target>
+  
+  <target name="compile" depends="init,-cocoon:check" >
+    <javac srcdir="${src.java}" destdir="${build.classes}" debug="true" >
+      <classpath refid="all.cp"/>
+      <include name="**/*.java"/>
+    </javac>
+  </target>
+
+  <target name="webapp" depends="compile, cocoon:xconf"
+          description="configure the webapp">
+    <copy todir="${cocoon.lib}">
+      <fileset dir="${lib}">
+        <include name="*.jar"/>
+      </fileset>
+    </copy>
+    <copy todir="${cocoon.classes}">
+      <fileset dir="${build.classes}" />
+    </copy>
+    <copy todir="${cocoon.webapp}">
+      <fileset dir="${src.webapp}" />
+    </copy>          
+  </target>  
+
+  <target name="zip" depends="init">
+    <zip zipfile="${zipfile}" basedir="." excludes="**/build/**, tools/**" />
+  </target>
+
+  <target name="war" depends="webapp" >
+    <jar destfile="${warfile}" basedir="${cocoon.webapp}" />
+  </target>
+  
+</project>
+    ]]></echo>
+  </target>
+  
+  <target name="seed-dirs">
+    <mkdir dir="${src.cocoon}" />
+    <mkdir dir="${src.cocoon}/webapp" />
+    <mkdir dir="${cocoon.xconf.dir}" />
+    <mkdir dir="${cocoon.tool.dir}" />
+    <mkdir dir="${cocoon.tool.dir}/webapp" />
+    <mkdir dir="src/java" />
+    <mkdir dir="lib" />
+  </target>
+  
+  <target name="msg-seed-userprops" if="existsUserProps">
+    <echo>user.properties already exists. This script cannot overwrite it.
+    If you want to regenerate the user.properties then manually delete it 
prior to running the seed target again.</echo>
+  </target>
+
+  <target name="seed-userprops" depends="msg-seed-userprops" 
unless="existsUserProps">
+    <echo file="user.properties">#
+# File automatically generated by ant script for YourCocoonBasedProject.
+# Manually extend it to your own needs.
+#
+cocoon.distro.home=${cocoon.distro.home}</echo>
+  </target>
+
+  <target name="msg-seed-cvsignore" if="existsCvsIgnore">
+    <echo>.cvsignore already exists. This script cannot overwrite it.
+    If you want to regenerate the .cvsignore then manually delete it prior to 
running the seed target again.</echo>
+  </target>
+
+  <target name="seed-cvsignore" depends="msg-seed-cvsignore" 
unless="existsCvsIgnore">
+    <echo file=".cvsignore">build
+tools
+user.properties</echo>
+  </target>
+
+  <target name="msg-seed-localprops" if="existsLocalProps" >
+    <echo>${cocoon.build.properties} already exists. This script cannot 
overwrite it.
+    If you want to regenerate the ${cocoon.build.properties} then manually 
delete it prior to running the seed target again.</echo>
+  </target>
+
+  <target name="seed-localprops" 
+          depends="msg-seed-localprops, seed-dirs" 
+          unless="existsLocalProps" >
+    <concat destfile="${cocoon.build.properties}" >
+      <fileset dir="${cocoon.distro.home}">
+        <include name="build.properties" />
+        <include name="blocks.properties" />
+      </fileset>
+    </concat>
+  </target>
+
+  <target name="seed" depends="seed-check, seed-localprops, seed-cvsignore, 
seed-userprops, seed-build">
+    <echo>Done.
+       
+    The directory src/cocoon/webapp is created to hold your cocoon 
+    webapp resources.
+    The directory src/cocoon/xconf is created to hold XConfPatch files 
+    to (optionally) modify the cocoon.xconf log.xconf web.xml and 
+    (root) sitemap.xmap
+
+    From here:
+    ---------
+    You should now edit the file ${cocoon.build.properties} to select 
+    only those optional components of Cocoon that your project needs.
+    IMPORTANT: Remove the path-entries from that file!
+    
+    The build.xml can freely be extended for your project needs.
+
+    To build a fresh Cocoon base for this project 
+    (when you updated the distro pointed to by -Dcocoon.distro.home)
+        > ant cocoon:get
+
+    To blend in your own project resources and classes:
+        > ant webapp
+
+    To test-run using the Jetty container:
+        > ant cocoon:run
+    </echo>
+  </target>
+</project>
+

Added: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.png
URL: 
http://svn.apache.org/viewcvs/cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.png?view=auto&rev=149502
==============================================================================
Binary file - no diff available.

Propchange: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.psd
URL: 
http://svn.apache.org/viewcvs/cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.psd?view=auto&rev=149502
==============================================================================
Binary file - no diff available.

Propchange: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/files/dirlayout.psd
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/meta.xml
URL: 
http://svn.apache.org/viewcvs/cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/meta.xml?view=auto&rev=149502
==============================================================================
--- 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/meta.xml
 (added)
+++ 
cocoon/whiteboard/doc-repos/2.2/src/documentation/content/xdocs/CocoonProjectAnt21/meta.xml
 Wed Feb  2 01:26:44 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<meta>
+  <authors>
+    <author contact="mailto:[EMAIL PROTECTED]">Helma van der Linden</author>
+  </authors>
+</meta>


Reply via email to