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 and the nested element
<extdirs>, which is used to specify other class files participating in the
inheritance hierarchy.
The elements support
path-like structures.
Example usage:
<ckjm outputfile="ckjm.xml" format="xml" classdir="build/classes">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
<extdirs path="lib" />
</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>
If the analyzed files form part of a class hierarchy of other class files that
are not part of the analysis, then the extdirs
path-like structure
of the ckjm task must be set to point to the directory containing
the corresponding jar files.
This will internally set the java.ext.dirs property so that
ckjm can locate the jar files containing those classes.