# Using Ckjm With Ant

First define the ant task in your `build.xml` file. The ckjm jar file should be in the classpath.

    <taskdef name="ckjm" classname="gr.spinellis.ckjm.ant.CkjmTask">
      <classpath>
        <pathelement location="path/to/ckjm1-2.jar"/>
      </classpath>
    </taskdef>

Now you can make use of the ckjm task. The attributes of the ckjm task are the following:

format
  'plain' or 'xml'. Default is 'plain'
outputfile
  Required. Output will be written to outputfile.
classdir
  Required. Base directory which contains the class files.

The ckjm task supports the nested elements <include> and <exclude>, which can be used to select the class files. The elements support path-like structures. Example usage:

    <ckjm outputfile="ckjm.xml" format="xml" classdir="build/classes">
      <include name="**/*.class" />
      <exclude name="**/*Test.class" />
    </ckjm>

You can use an XSL stylesheet to generate an HTML report from the XML output file. Example:

    <style in="ckjm.xml" style="path/to/ckjm.xsl" out="ckjm.html" />

The distribution contains in the `xsl` directory two sample XSL files. Here is a complete example of a build.xml file.

    <project name="myproject" default="ckjm">

    <target name="compile">
      <!-- your compile instructions -->
    </target>

    <target name="ckjm" depends="compile">

      <taskdef name="ckjm" classname="gr.spinellis.ckjm.ant.CkjmTask">
        <classpath>
          <pathelement location="path/to/ckjm1-2.jar"/>
        </classpath>
      </taskdef>

      <ckjm outputfile="ckjm.xml" format="xml" classdir="build/classes">
        <include name="**/*.class" />
        <exclude name="**/*Test.class" />
      </ckjm>

      <style in="ckjm.xml" style="path/to/ckjm.xsl" out="ckjm.html" />
    </target>

Contents | « Previous Next (Web Links and Acknowledgements) »