CheckThread.org

Ant Task

STEP 1: Download Ant Task

  • Distributed under the open source MIT license
  • Includes annotations & static analysis tool
  • Includes wrapper ant task
  • Includes examples so you can get up and running quickly!

STEP 2: Run Test Examples

  • CheckThread requires Java 1.5 or later
  • Install Apache Ant
  • Download and unpack the checkthread zip file
  • Run checkthread on sample in the /examples directory
    • ant -f build.xml
    • ant -f analyze.xml -lib ../dist -lib ../lib
  • You should see a sample thread policy error
  • See if you can fix the thread policy error!

STEP 3: Try CheckThread on Your Java Application!

  • Copy the example analyze.xml snippet into your Ant task
  • Explore and have fun!

Ant Task Properties

  • The targetpath property is the directory containing class files that you wish to analyze
  • The classpath property is the classpath used by the Java project. It's the same classpath used when building the Java project.
  • Typically targetpath is a subset of classpath representing the Java classes that you are actively developing. It's inefficient to include everything on targetpath, only include the Java code that is using the CheckThread annotations.

<!-- DEFINE ANT TASK -->
<taskdef name="checkthread"
classname="org.checkthread.anttask.CheckThreadTask" />

-- RUN CHECKTHREAD -->
<target name="analyze">
<checkthread
targetpath="${classDir}/mypackage/"
classpath="${classDir}"
verbose="false"/>
</target>
©2008 CheckThread