jacson logo courtesy from Doris & Frank.Getting started > How to run it? > The Integration into Ant2005-10-04 00:11:20 v0.90
Jacson, say Jackson, think J-Scan

The Integration into Ant

What is Jacson?
Getting started
  Download instructions
  How to install?
  How to run it?
    The Commandline
    The Integration into Ant
      The Jacson Ant Task
    Embed in a Java Program
How it works?
How to Contribute?
Developer Information
Other information

Let's assume you know what Jakarta Ant is.

There are two entirely different ways to embed Jacson into a Ant task.

The Ant Task

The JacsonTask needs to be registered with Ant. If you have the jacson.jar and the additional jar-files in your classpath this is looks like

<taskdef name="jacson"
in your build.xml. A sample for a startable task in the shipped build.xml
01:  <target name="demo3" depends="taskdemo-prepare">
02:      <property name="count" value="42"/>
03:      <jacson config="${sample.dir}/head.conf" out="demo3.txt"
04:              in="${sample.dir}/data/access.log.gz"
05:              />
06:      <echo>count="${count}"</echo>
07:  </target>
This task starts the configuration explained above. When you run it, you will observe, that the task grabs the first 42 lines of the log file access.log.gz instead of the first 2. That is, settings in the build.xml override settings in the head.conf. Note: This is not entirely true as demonstrated in other demo tasks. Once the JacsonTask has set a variable Ant refuses to change it. This could easily be changed in the ProjectJacsonState, but maybe it is a feature and not a bug.

Fore more information please have a look at the demoX tasks in the shipped build.xml.

Note: There are is a problem concerning Ant Tasks right now. To avoid getting strange output and Ant configuration should only have one toplevel report and no filename attached to it! Then the AntTask output Attribute can be used to determine output.
If you have more than one report output is merged into that single output file in a hard to predict order. If you have filenames attached to reports in the Jacson configuration, you'll get those files empty as a result :-)

The Filter

The JacsonAntFilter plugs into Ant FilterChains as demonstrated in the included build.xml in the task demofilter1.

Of course you need to have Jacson in your classpath or use the <filterreader> subelement <classpath> to point to jacson.jar.

The second most important thing about the Filter is that you need a Ant Filter parameter <param> named config pointing to a configuration file. That is the configuration must look like

  ... more filters ...
  <filterreader classname="de.spieleck.app.jacson.ant.JacsonAntFilter">
      <classpath ...point.to.jacson.jar.if.not.globaly/>
      <param name="config" value="point.to.your.configuration"/>
  ... more filters ...

Note: JacsonAntFilter is an application (and subclass) of the JacsonReader.

NewsfeedRSS feed
FilefeedRSS feed
Sourceforge Logo