我无法让我的 Ant 脚本(用于 BlackBerry 构建)运行preverify.exe
命令并将正确的参数传递给它。
在命令提示符 (Windows 7) 中,这 100% 有效 - 给定的参数正常工作:
preverify -verbose -classpath C:\development\tools\bb-jde\jde5.0\components\lib\net_rim_api.jar -d build\classes\preverified build\classes\preverified build\classes\unverified
我尝试使用以下目标将其放入我的 Ant 脚本中 - 尝试使用相同的参数:
<target name="preverify">
<mkdir dir="${dest.dir}/classes/preverified" />
<exec executable="${jde.home}/bin/preverify">
<arg value="-verbose" />
<arg value="-classpath C:\development\tools\bb-jde\jde5.0\components\lib\net_rim_api.jar" />
<arg value="-d build\classes\preverified" />
<arg value="build\classes\unverified" />
</exec>
</target>
这不起作用。我收到以下错误:
Illegal option
-classpath C:\development\tools\bb-jde\jde5.0\components\lib\net_rim_api.jar
- 这个类路径在命令行中是完全可以接受的(通常 java 命令接受 JAR 文件作为目录,因为它们基本上是 ZIP 文件)。
如何让 Ant 向该命令发送正确的参数,就像在命令行版本中一样?一定有什么exec
我想念的吗?
以下是在详细模式下运行此目标的完整 Ant 输出,如果有帮助的话:
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Trying the default build file: build.xml
Buildfile: C:\development\ant\test_using_javac_jar_preverify_then_rapc\Cobi\build.xml
Detected Java version: 1.6 in: C:\Java\jdk1.6.0_24\jre
Detected OS: Windows 7
parsing buildfile C:\development\ant\test_using_javac_jar_preverify_then_rapc\Cobi\build.xml with URI = file:/C:/development/ant/test_using_javac_jar_preverify_then_rapc/Cobi/build.xml
Project base dir set to: C:\development\ant\test_using_javac_jar_preverify_then_rapc\Cobi
parsing buildfile jar:file:/C:/development/tools/apache-ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/development/tools/apache-ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
Importing file C:\development\ant\common\constants.xml from C:\development\ant\test_using_javac_jar_preverify_then_rapc\Cobi\build.xml
Overriding previous definition of reference to ant.projectHelper
parsing buildfile C:\development\ant\common\constants.xml with URI = file:/C:/development/ant/common/constants.xml
parsing buildfile jar:file:/C:/development/tools/bb-ant-tools/bb-ant-tools.jar!/bb-ant-defs.xml with URI = jar:file:/C:/development/tools/bb-ant-tools/bb-ant-tools.jar!/bb-ant-defs.xml from a zip file
Overriding previous definition of reference to ant.projectHelper
[property] Loading C:\development\ant\test_using_javac_jar_preverify_then_rapc\Cobi\project.properties
[property] Loading C:\development\ant\common\jde5.0.properties
[property] Loading C:\development\ant\common\common.properties
[pathconvert] Set property net_rim_api.jar.dos = C:\development\tools\bb-jde\jde5.0\components\lib\net_rim_api.jar
Build sequence for target(s) `preverify' is [preverify]
Complete build sequence is [preverify, javac, build, sign, clean, ]
preverify:
[mkdir] Skipping C:\development\ant\test_using_javac_jar_preverify_then_rapc\Cobi\build\classes\preverified because it already exists.
[exec] Current OS is Windows 7
[exec] Executing 'C:\development\tools\bb-jde\jde5.0\components\bin\preverify' with arguments:
[exec] '-verbose'
[exec] '-classpath C:\development\tools\bb-jde\jde5.0\components\lib\net_rim_api.jar'
[exec] '-d build\classes\preverified'
[exec] 'build\classes\unverified'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] preverify: Illegal option -classpath C:\development\tools\bb-jde\jde5.0\components\lib\net_rim_api.jar
[exec]
[exec] Usage: preverify [options] classnames|dirnames ...
[exec]
[exec] where options include:
[exec] -classpath <directories separated by ';'>
[exec] Directories in which to look for classes
[exec] -d <directory> Directory in which output is written (default is ./output/)
[exec] -cldc1.0 Checks for existence of language features prohibited
[exec] by CLDC 1.0 (native methods, floating point and finalizers)
[exec] -nofinalize No finalizers allowed
[exec] -nonative No native methods allowed
[exec] -nofp No floating point operations allowed
[exec] @<filename> Read command line arguments from a text file
[exec] Command line arguments must all be on a single line
[exec] Directory names must be enclosed in double quotes (")
[exec]
[exec] Result: 1
BUILD SUCCESSFUL
Total time: 1 second