AntME logo   AntME title
fill

The 'meJadEdit' Task

The meJadEdit class allows JAD files to be created by Ant build files. It also allows existing JAD files to be edited. The task has the following basic format:

   <meJadEdit  outputjad="path to output jad file"
               [inputjad="path to input jad file"]
               [encoding="file encoding" >]
       [<attribute name="attrName" value="attrValue" />]
       [<name value="midlet name" />]
       [<version value="midlet version" />]
       [<incrementVersion />]
       [<vendor value="midlet vendor" />]
       [<icon value="midlet icon" />]
       [<description value="midlet description" />]
       [<jarUrl value="JAR URL" />]
       [<infoUrl value="Info URL" />]
       [<dataSize value="data size" />]
       [<midp value="1.0" | "2.0" />]
       [<cldc value="1.0" | "1.1" />]
       [<jarSize value="jar size" | file="jar file" />]
       [<clearMidlets/>]
       [<addMidlet name="name" [icon="icon"] className="className" />]
       [<setMidlet number="#" name="name" [icon="icon"] className="className" />]
       [<removeMidlet name="name" | className="className" | number="#" />]
   </meJadEdit >

meJadEdit Task Attributes

AttributeValue
inputjad Relative or absolute path to a JAD file that is to be loaded. If this is omitted, the task starts with an empty JAD file, allowing a JAD file to be created from scratch.
outputjad Relative or absolute path indicating where the JAD file should be saved. This path may be the same as the inputjad parameter, in which case the JAD file is edited in place.
encoding Specifies the encoding of the input and output JAD file. If omitted, "UTF-8" is assumed.

The actual edit operations performed on the JAD file are specified by the various nested tags that can be provided within the meJadEdit task:

Tag NameFunctionality
attribute This tag allows one to set a generic attribute. Use the name and value attributes to specify the name and contents of the attribute. Note that, for the standard MIDP attributes, it is better to use one of the tags provided below. This guarantees that the correct capitalization, etc. is used.
name Sets the MIDlet-Name attribute.
version Sets the MIDlet-Version attribute. The provided value may have one, two or three parts, separated by periods (if there is more than one). Each of the parts must have a value between 0 and 99.
incrementVersion This operation increments the version number found in the JAD file. If the JAD file does not have a MIDlet-Version attribute, the version number 0.0.1 will be generated.
vendor Sets the MIDlet-Vendor attribute.
icon Sets the MIDlet-Icon attribute.
description Sets the MIDlet-Description attribute.
jarUrl Sets the MIDlet-Jar-URL attribute.
infoUrl Sets the MIDlet-Info-URL attribute.
dataSize Sets the MIDlet-Data-Size attribute.
midp Sets the MicroEdition-Profile attribute. The value should be either "1.0" or "2.0".
cldc Sets the MicroEdition-Configuration attribute. The value should be either "1.0" or "1.1".
jarSize Sets the MIDlet-Jar-Size attribute. This value can be specified in one of two ways: directly, using the value attribute, or derived from a JAR file, using the file attribute. The latter is the more common use.
clearMidlets Removes all of the MIDlet definitions from the JAD file.
addMidlet Adds a MIDlet definition to the JAD file. The name and className for the MIDlet must be provided, and an icon attribute optionally specifies the icon for the MIDlet.
setMidlet Sets a specific MIDlet definition entry, possibly overwriting the one previously provided in the file. The MIDlet entry to set is specified by the number attribute. Thus, specifying number="1" targets the MIDlet-1 entry. The name and className for the MIDlet must be provided, and an icon attribute optionally specifies the icon for the MIDlet.
removeMidlet Removes a particular MIDlet entry. The entry to be removed may be specified by name, className, or number.

Automatic Transformations

When a JAD file is written, this task automatically does the following:

  1. "Normalizes" all the attribute names. Thus, if the input JAD file has a non-standard capitalization, or if one of the standard attributes is incorrectly specified using the <attribute ...> tag, the writing process will correct it.
  2. Collapses the MIDlet definitions, eliminating any "gaps" in the numbering.
  3. Re-orders the JAD attributes into alphabetical order. Note that the MIDP specification does not require a particular ordering within the JAD file - this ordering is a side effect of the implementation.