The ant-javacard task uses a hierarchical XML structure to define how CAP files are generated.
<javacard> tag
This is the generic task wrapper.
jckit: Path to the JavaCard SDK used if individual <cap> elements do not specify one. This has high precedence (overrides JC_HOME).
<cap> tag
This construct defines a specific CAP file to be built.
jckit: Path to the JavaCard SDK to be used. Required if not defined in <javacard>.targetsdk: Path to the target JavaCard SDK, or a version name (e.g., "3.0.4", "3.1.0", "3.2.0", or "preview"). This allows using a newer converter to target older platforms.sources: Path(s) to Java source code. Required if classes is not provided (unless using default paths like src/main/javacard).classes: Path to pre-compiled class files. If both sources and classes are provided, compiled classes are placed in the classes folder.package: Name of the package. Required for libraries; optional for applets (defaults to parent package).aid: Hex AID of the package. Recommended.output: Path where to save the generated CAP file.export: Path (folder) to place the generated JAR and EXP files.verify: If false, disables off-card verification.debug: If true, generates debug CAP components.strip: If true, removes class files from the target CAP.ints: If true, enables support for 32-bit int type.
<applet> tag
Used inside <cap> to define an applet within the package.
class: The class where the install() method is defined. Required.aid: Hex AID of the applet. Recommended.
<import> tag
Used for linking external libraries (e.g., GPSystem).
exps: Path to the folder containing .exp files. Required if the imported JAR doesn't include them.jar: Path to the JAR file for compilation.
<javacard jckit="/path/to/jckit_dir1">
<cap targetsdk="/path/to/jckit_dir2" aid="0102030405" package="package.name" version="0.1" output="MyApplet.cap" sources="src/myapplet" classes="path/to/classes" export="mylib">
<applet class="myapplet.MyApplet" aid="0102030405060708"/>
<import exps="path/to/exps" jar="/path/to/lib.jar"/>
</cap>
</javacard>