With Ant, how do I create seperate jar files from one src directory?
I have one source directory in which I am trying to create separate cod files since my resources (PNG files) are beyond the limit imposed by the RAPC compiler.
I am trying to create:
- .cod(s) for the source
- .cod(s) for low res. resources
- .cod(s) for hi res. resources
Which I am successful in creating the following:
AppMeasurement_BlackBerry.cod
com_mch_coffeehouse-1.cod
com_mch_coffeehouse.cod
com_mch_coffeehouse.jad
com_mch_coffeehouse_resources_hires-1.cod
com_mch_coffeehouse_resources_hires-2.cod
com_mch_coffeehouse_resources_hires-3.cod
com_mch_coffeehouse_resources_hires-4.cod
com_mch_coffeehouse_resources_hires-5.cod
com_mch_coffeehouse_resources_hires-6.cod
com_mch_coffeehouse_resources_hires-7.cod
com_mch_coffeehouse_resources_hires.cod
com_mch_coffeehouse_resources_lowres-1.cod
com_mch_coffeehouse_resources_lowres-2.cod
com_mch_coffeehouse_resources_lowres-3.cod
com_mch_coffeehouse_resources_lowres-4.cod
com_mch_coffeehouse_resources_lowres.cod
common-1.cod
common.cod
However, the application does not start-up and from the event log on the device, I get that wonderful encrypted message:
RIM Wireless Handheld Java Loader Copyright 2001-2009 Research In Motion Limited Connected guid:0x97C9F5F641D25E5F time: Wed Dec 31 19:00:00 1969 severity:0 type:2 app:System data:JVM:INFOp=23575346,a='5.0.0.979',o='5.1.0.177',h=4001507 guid:0x9C3CD62E3320B498 time: Fri Jul 01 16:59:26 2011 severity:1 type:3 app:Java Exception data: Error No detail message com_mch_coffeehouse(4E0E2E1F) CoffeeHouseClient 0x3764 com_mch_coffeehouse(4E0E2E1F) CoffeeHouseClient main 0x30BD guid:0x0 time: Fri Jul 01 16:59:26 2011 severity:2 type:3 app: data: Traceback:
guid:0x97C9F5F641D25E5F time: Fri Jul 01 16:59:31 2011 severity:0 type:2 app:System data:JVM:INFOp=23575346,a='5.0.0.979',o='5.1.0.177',h=4001507
Anyway, any help or suggestions is greatly appreciated before this becomes a critical blocker - yippee!
My Ant script:
<?xml version="1.0" encoding="UTF-8"?>
<property name="package.label" value="com_mch_coffeehouse" />
<property name="lowres.label" value="com_mch_coffeehouse_resources_lowres" />
<property name="hires.label" value="com_mch_coffeehouse_resources_hires" />
<property name="jde.home" value="C:\Eclipse3.6\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components" />
<property name="workspace" value="C:\Users\jtp\Documents\mch" />
<property name="appmeasure" value="${workspace}\AppMeasurement_BlackBerry\deliverables\Standard\5.0.0" />
<property name="common" value="${workspace}\Common-BlackBerry\deliverables\Standard\5.0.0" />
<property name="simulator" value="${jde.home}\simulator" />
<property name="bin" value="${jde.home}\bin" />
<property name="src" value="src" />
<property name="respackage" value="${src}\com\mch\coffee_house\res" />
<property name="hi" value="${respackage}\hi" />
<property name="low" value="${respackage}\low" />
<property name="dest" value="deliverables" />
<property name="ota.dir" value="${dest}\ota" />
<target name="debug" depends="ota" description="Build, deploy project and Launches Remote Debug Server">
<exec executable="cmd.exe" dir="${bin}" spawn="true">
<arg value="/c" />
<arg value="jdwp.bat" />
</exec>
</target>
<target name="simulate" depends="ota" description="Build, deploy project and Launches Simulator">
<exec executable="cmd.exe" dir="${simulator}" spawn="true">
<arg value="/c" />
<arg value="${simulator}\9700.bat" />
</exec>
</target>
<target name="ota" depends="build" description="Build OTA project.">
<mkdir dir="${ota.dir}" />
<jadtool input="${dest}\${package.label}.jad" destdir="${ota.dir}">
<fileset dir="${appmeasure}" includes="*.cod" />
<fileset dir="${common}" includes="*.cod" />
<fileset dir="${dest}" includes="*.cod" />
</jadtool>
</target>
<target name="deploy" depends="build" description="Build and deploy project.">
<copy todir="${simulator}" overwrite="true">
<fileset dir="${appmeasure}">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.csl" />
<include name="*.cso" />
</fileset>
</copy>
<copy todir="${simulator}" overwrite="true">
<fileset dir="${common}">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.csl" />
<include name="*.cso" />
</fileset>
</copy>
<copy todir="${simulator}" overwrite="true">
<fileset dir="${dest}">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.csl" />
<include name="*.cso" />
</fileset>
</copy>
</target>
<target name="build" depends="buildhiresources" description="Builds project.">
<!-- Copy the resource package to be compiled with preserved folder hierarchy -->
<!--<copy todir="${dest}">
<fileset dir="${src}">
<include name="com/mch/coffee_house/res/low/*.png" />
<include name="com/mch/coffee_house/res/hi/*.png" />
<exclude name="**/*.java" />
<exclude name="com/mch/coffee_house/res/torch/*.png" />
</fileset>
</copy>-->
<!--
${appmeasure}\AppMeasurement_BlackBerry.jar:${common}\danicacommon.jar:${dest}\com_mch_coffeehouse_resources_hires.jar:${dest}\com_mch_coffeehouse_resources_lowres.jar
-->
<rapc jdehome="${jde.home}" jdkhome="${java.home}" import="${appmeasure}\AppMeasurement_BlackBerry.jar:${common}\danicacommon.jar:${dest}\com_mch_coffeehouse_resources_hires.jar:${dest}\com_mch_coffeehouse_resources_lowres.jar" destdir="${dest}" noconvert="false" output="${package.label}" quiet="true" verbose="false" generatesourcelist="false" nopreverify="true">
<jdp type="cldc" title="mch coffeehouse" vendor="MCH Inc" version="1.0.0" description="Find a coffee house from your BlackBerry device." arguments="" systemmodule="false" runonstartup="false" startuptier="7" ribbonposition="0" nameresourcebundle="com.mch.coffeehouse" nameresourceid="0" icon="../src/com/mch/coffee_house/res/hi/icon.png">
</jdp>
<src>
<fileset dir=".">
<exclude name="src/com/mch/coffee_house/res/hi/*.java*" />
<exclude name="src/com/mch/coffee_house/res/low/*.java*" />
<include name="src/**/*.java*" />
<include name="src/**/*.rrc*" />
<include name="开发者_开发百科src/**/*.rrh*" />
<include name="src/**/*.cod*" />
<include name="src/**/*.cso*" />
<include name="src/**/*.MF*" />
<!-- Add the preserved folder hierachy to be compiled as is -->
<!--<include name="${dest}/com/**/*.*" />-->
</fileset>
</src>
</rapc>
<sigtool jdehome="${jde.home}" password="########" close="false">
<fileset dir="${dest}" includes="*.cod" />
</sigtool>
</target>
<!-- Hi Res. Resources -->
<target name="buildhiresources" depends="buildlowresources" description="Builds low resolution resources project.">
<!-- Copy the resource package to be compiled with preserved folder hierarchy -->
<copy todir="${dest}">
<fileset dir="${src}">
<include name="com/mch/coffee_house/res/hi/*.png" />
<exclude name="com/mch/coffee_house/res/low/*.png" />
<exclude name="**/*.java" />
<exclude name="com/mch/coffee_house/res/torch/*.png" />
</fileset>
</copy>
<rapc jdehome="${jde.home}" jdkhome="${java.home}" destdir="${dest}" noconvert="false" output="${hires.label}" quiet="true" verbose="false" generatesourcelist="false" nopreverify="true">
<jdp type="library" title="MCH Library" vendor="MCH Inc" version="1.0.0" description="coffeehouse hi-res resources library.">
</jdp>
<src>
<fileset dir=".">
<!-- Add the preserved folder hierachy to be compiled as is -->
<include name="src/com/mch/coffee_house/res/hi/*.java*" />
<include name="${dest}/com/**/*.*" />
<exclude name="${dest}/com/mch/coffee_house/res/low/*.png" />
</fileset>
</src>
</rapc>
<sigtool jdehome="${jde.home}" password="########" close="false">
<fileset dir="${dest}" includes="*.cod" />
</sigtool>
</target>
<!-- Low Res. Resources -->
<target name="buildlowresources" description="Builds low resolution resources project.">
<!-- Copy the resource package to be compiled with preserved folder hierarchy -->
<copy todir="${dest}">
<fileset dir="${src}">
<exclude name="com/mch/coffee_house/res/hi/*.png" />
<include name="com/mch/coffee_house/res/low/*.png" />
<exclude name="**/*.java" />
<exclude name="com/mch/coffee_house/res/torch/*.png" />
</fileset>
</copy>
<rapc jdehome="${jde.home}" jdkhome="${java.home}" destdir="${dest}" noconvert="false" output="${lowres.label}" quiet="true" verbose="false" generatesourcelist="false" nopreverify="true">
<jdp type="library" title="MCH Library" vendor="MCH Inc" version="1.0.0" description="coffeehouse low-res resources library.">
</jdp>
<src>
<fileset dir=".">
<!-- Add the preserved folder hierachy to be compiled as is -->
<include name="src/com/mch/coffee_house/res/low/*.java*" />
<include name="${dest}/com/**/*.*" />
</fileset>
</src>
</rapc>
<sigtool jdehome="${jde.home}" password="########" close="false">
<fileset dir="${dest}" includes="*.cod" />
</sigtool>
</target>
<target name="clean" description="Clean the destination directory.">
<delete dir="${ota.dir}" failonerror="no" />
<delete dir="${dest}" failonerror="no" />
<mkdir dir="${dest}" />
</target>
Use BlackBerry Ant Tools and Preprocessor to generate separate folders with source files and resources and compile them to separate application files.
精彩评论