September 29, 2004
BlackBerry Development: Using Apache Ant
If you look at the
Listing 4a. Original JAD Template File
MIDlet-Name: @midletName@ MIDlet-Version: @buildVer@ MIDlet-Vendor: J2MEDeveloper MIDlet-Description: MicroEdition-Profile: MIDP-1.0 MicroEdition-Configuration: CLDC-1.0 MIDlet-Jar-URL: @jarName@ MIDlet-Jar-Size: @jarSize@ MIDlet-1: ,,
Listing 4b. Final JAD File - Versioned and with BlackBerry-specific Information
Manifest-Version: 1.0 MIDlet-Jar-Size: 160220 MIDlet-1: ,, MIDlet-Jar-URL: MyAppClient.jar MicroEdition-Configuration: CLDC-1.0 MIDlet-Version: 1.0 MIDlet-Name: MyAppClient
Listing 5a. Original MANIFEST Template File
MIDlet-Name: @midletName@ MIDlet-Version: @buildVer@ MIDlet-Vendor: J2MEDeveloper MIDlet-Description: MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0 MIDlet-1: , ,
Listing 5b. Final Versioned MANIFEST File
Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.1 Created-By: 1.4.2-b28 (Sun Microsystems Inc.) MIDlet-Name: MyAppClient MIDlet-Version: 1.0 MIDlet-Vendor: J2MEDeveloper MIDlet-Description: MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0 MIDlet-1: , ,
Running Our Application from Within Ant
Running our application in the simulator requires us to first copy the generated files into the simulator directory, then invoke the appropriate simulator with the appropriate arguments. For this we will add two more steps to our Ant script:
The simulator to invoke will depend on which simulators you have installed on
your computer. To write our run build task for a particular handset the easiest thing to do is to open the appropriate batch file for the simulator
for the handset of interest (found in the simulator directory), and
just transfer the input arguments into the Ant task. For example, for the the
7500 handset we would open the OS7500.bat batch file. We will see
that the batch file invokes the
If you look at Listing 6 below, you will see how our Listing 6. Ant Tasks to Run Your Application
<target name="updatesim" description="Update BlackBerry Simulator">
<copy todir="${blackberry.simulator.path}/">
<fileset dir="output/tocod"/>
</copy>
</target>
In Summary
In this article we have covered the JDE's build capabilities. We also covered Ant, its benefits, and how to use if for your BlackBerry build process. Ant is a very powerful build tool, and with this article you should now have enough information to support Ant for all your BlackBerry builds, build your application from IDEs such as IDEA, Eclipse and Netbeans, and integrate your BlackBerry build into your overall build process. Resources
C. Enrique Ortiz is a software architect and developer, and a mobile/wireless technologist and writer. He is author or co-author of many publications, a co-designer of Sun Microsystems' the Mobile Java Developer Certification Exam, and has been an active participant in the wireless Java community and of various J2ME expert groups.
|
|
||||||||||||||||||||||||||||
|
|
|
|