forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Noels <>
Subject Cocoon Ant Task committed
Date Sun, 03 Nov 2002 21:06:50 GMT
Yummy (if it does what Bernhard claims it does).

-------- Original Message --------
Subject: cvs commit:
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/ant readme.txt
Date: 3 Nov 2002 20:26:50 -0000

huber       2002/11/03 12:26:50

    Added:       src/scratchpad/src/org/apache/cocoon/ant
    A simple ant task for launching cocoon. see readme.txt for additional

    Index: readme.txt
     This directory implements a Cocoon Ant Task.

     The basic attributes of this ant task are taken from
     Beside implementing launching Cocoon via ant the number of Cocoon
     invocation should be reduced compared to the Main implementation.

     Another trigger for implementing an Ant task:
     I wanted to exploit a bit launching cocoon from a different environment
     than servlet, and main-commandline environment.

     Side Note:
       Main invokes Cocoon for getting the links for a URI, it
       invokes Cocoon for getting the content type of a URI, and
       finally it invokes Cocoon for getting the page content itself.

     This implementation skips getting the content type of a URI,
     by implementing a DelayedFileSavingEnvironment. This class
     write the content of a page into a ByteArrayBuffer till the content 
     of page has been settled. This should and will save time generating
     off-line pages.
     Moreover getting links of an URI is reduced to URIs having content
type text/*.
     This should speed up the page generation a bit more. This feature 
     be made configurable...

     Classloader Note:
       I struggled a bit making Cocoon running as an Ant task, the
       the classpath for loading the cocoon task should include all
       classes need for running cocoon too.
       In the CocoonTask java code itself the
       is absolutly important, otherwise Cocoon will fail configuring using
       it starup manager.
       Of course you can define all Cocoon classes in your java classpath
       environment, but i wanted to avoid this. Defining all needed
classes only
       in the ant script.

     Cocoon Ant task usage:
     <project basedir="." default="cocoon-docs" name="cocoon-docs">
       <property name="cocoon.dir" value="your-cocoon-directory"/>

       <path id="cocoon.classpath">
         <fileset dir="${cocoon.dir}/lib">
         <include name="core/jvm1.4/*.jar"/>
         <include name="core/*.jar"/>
         <include name="optional/*.jar"/>
         <fileset dir="${cocoon.dir}/build/cocoon">
         <include name="*.jar"/>

         description="[internal] define the task for launching Cocoon">

         <taskdef name="cocoon" classname="org.apache.cocoon.ant.CocoonTask"

       <target name="cocoon-docs" depends="prepare-cocoon-docs"
         description="* build cocoon documentation">

         <property name="contextDir"
         <property name="workDir"
         <property name="destDir"


     CocoonTask Attributes

     Cocoon Creation

     contextDir - Cocoon's context directory, mandatory
     configFile - specifies cocoon xconf file, by default try using

     workDir - Cocoon's work directory, by default sub directory work of
directory specified
     by system property

     Cocoon Logging
     logLevel - log level option DEBUG, INFO, WARN, ERROR, by default INFO
     logger - logger category, by default "cocoon"
     logkitXconf - logkit xconf file, by default try using

     Processing Cocoon options
     targets - comma, space, or semicolon seperated list of target URIs,
eg. /index.html,

     acceptHeader - accept header, by default text/html, * / *
     agentHeader - agent header, by default Apache Cocoon 2.1-dev

     Processing Cocoon File Generation
     destDir - destination directory of generated targets, mandatory

     Processing Cocoon Modes
     followLinks - boolean value, iff following links should be
processed, by default true
     precompileOnly - boolean value, iff xsp precompile should be
performed, by default false,
     not evaluted - yet

     Processing Cocoon Link Generation

     Processing Cocoon Index Generation

    Future Plans
     I think about creating some ant inner classes for specifying some
more subtask
     Subtask ideas:
       Offline index generation
       Offline xsp compilation
       Offline link generation

     Ideas are welcome
     Have fun.

In case of troubles, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

Steven Noels                  
Outerthought - Open Source, Java & XML Competence Support Center            

View raw message