Runs Retroweaver on a directory or set of directories to convert classes produced by a JDK 1.5 compliant compiler to a class file format supported by older JVM's.
Attribute | Description | Required |
srcdir | The directory containing classes to process. | One of either srcdir, inputjar or a nested fileset element. |
destdir | The destination directory for the processed classes. | No. If not specified, the processed classes overwrite the source classes. |
inputjar | The jar file to proces. | One of either srcdir, inputjar or a nested fileset element. |
outputjar | The jar file for the processed classes. | Yes if inputjar is specified. |
classpath | The classpath for reference verification. For example, retroweaver-rt-<version>.jar;c:\java\jdk1.4\lib\rt.jar;my-classes | No. If not specified, Retroweaver will not verify references. |
verify | Indicates whether the verifier should be called. Note that the verifier is skipped if classpath is not defined. | No. Defaults to true. |
target | The target version as either "1.2", "1.3", or "1.4". | No. Defaults to "1.4". |
stripSignatures | Indicates whether the generic signatures should be stripped. | No. Defaults to false. |
stripAttributes | Indicates whether the custom Retroweaver attributes should be stripped. | No. Defaults to false. |
lazy | Indicates if classes that already have the target version should be skipped. If the destination directory is different from the source directory, such classes are copied to the destination with preserved timestamp. | No. Defaults to true. |
failonerror | Indicates if the build should fail if an error occurs while processing classes. If false, a warning is logged but the build continues. | No. Defaults to true. |
verbose | Indicates if the names of processed files should be logged. | No. Defaults to false. |
fileset
One ore more filesets can be specified instead of (or in addition to) the srcdir attribute. Make sure that the fileset only includes class files.
Declare the Retroweaver class. The example assumes that the property "retroweaver.home" points to the RetroWeaver installation.
<taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask"> <classpath> <fileset dir="${retroweaver.home}/lib" includes="**/*"/> <pathelement location="${retroweaver.home}/release/retroweaver-all-<version>.jar"/> </classpath> </taskdef>
Convert a set of classes in a single directory to JDK 1.4 compatible format.
<target name="weave" depends="compile"> <retroweaver srcdir="classes"/> </target>
Convert a set of classes, using a fileset, to JDK 1.3 compatible format in another directory.
<target name="weave" depends="compile"> <mkdir dir="classes-13"/> <retroweaver destdir="classes-13" target="1.3"> <fileset dir="classes"> <include name="**/*.class"/> </fileset> </retroweaver> </target>