To use Contractchecker , you first have to declare its task. You could define a specific target for it as follows:

< !--

Declares ContractChecker task.

@return the correctly declared ContractChecker task.

-- >

< target name="declare.contractchecker.task" >

< description > Declares ContractChecker task < /description >

< !--

Defines the < i > ContractChecker < /i > task.

-- >

< taskdef



classpathref="contractchecker.classpath"/ >

< /target >

Now you can execute ContractChecker giving it the information it needs:

< !--

Executes ContractChecker.

-- >

< contractchecker




violationexception="org.acmsl.contractchecker.ContractViolation"/ >

Table 1 - ContractChecker properties
ContractChecker properties
Attribute Description Required
sourceroots The path containing the Java source files to build. Keep in mind that ContractChecker supports all iajc -specific settings, so if you already use AspectJ as compiler, you'll still be able to use the same settings, since it's been carefully designed to provide compatibility with it. yes
destdir The folder where the compiled files will be created. Yes
classroots The classpath used to build the sources. yes
violationexception The concrete runtime exception to throw whenever a contract has been violated. Yes

The source code of ContractChecker provides a build script used to export the project itself, and which can be used as a reference.