如果你使用 ant,这里有一些你会发现有用的目标:
<target name="zip" depends="init" description="Archive your files before building the bar" >
<zip
destfile="${build.dir}/${type.name}.zip"
basedir="${basedir}"
excludes="*.project,*.settings/,.*properties,*.svn,*.svn/*, builder/, .gitignore, .git/*"
includes="*,WebContent/"
/>
</target>
<target name="bar" depends="zip" description="create the bar file" >
<exec executable="${bbwp}">
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="${build.dir}/${type.name}.zip"/>
<arg line="-o '${build.dir}'" />
<arg line="-v" />
<!-- Allows debugging on port 1337 -->
<arg line="-d" />
<!-- Sign to Appworld -->
<!-- <arg line="-g ${keyPass} - -buildId 10" /> -->
</exec>
</target>
<target name="install" depends="bar" description="Deploy the the .bar file to your simulator. The old application is automatically uninstalled." >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-installApp" />
<arg value="-launchApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
<target name="uninstall" description="Uninstall an application from the Simulator. " >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-uninstallApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
这里是一个 windows 环境变量的例子:
<property name="password" value=""/>
<property name="simIP" value="169.254.0.1" />
<property name="keyPass" value="" />
<property name="sdk.HOME" location="C:\Program Files\Research In Motion\BlackBerry 10 WebWorks SDK 1.0.1.8" />
<property name="build.dir" location="${basedir}\build" />
<property name="bar.file" location="${build.dir}\device\${type.name}.bar" />
<property name="sdk.JAVA_HOME" location="C:\Program Files\Java\jre6" />
<property name="bbwp" location="${sdk.HOME}\bbwp.bat" />
<property name="BarDeploy.dir" location="${sdk.HOME}\dependencies\tools\lib" />