我使用的是workklight 6.2,并在linux机器命令行上编写了以下ant任务来构建war文件。
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="opt/IBM/Worklight/WorklightServer/worklight-ant-builder.jar"/>
</classpath>
</taskdef>
<target name="build-war">
<war-builder projectfolder="${basedir}"
destinationfolder="bin/"
warfile="bin/MyProject.war"
classesFolder="classes-folder"/>
</target>
当我使用以下命令"ant-f/opt/MyWS/MyProject/build.xml"build-war执行任务时,它会给我以下错误:
Problem: failed to create task or type war-builder
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
ANT_HOME设置为"/opt/IBM/TWorklight/tools/apache-ANT-1.84"。当我在eclipse中执行相同的任务时,它运行良好。
似乎没有正确设置jar文件的路径(您错过了根斜杠):
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="/opt/IBM/Worklight/WorklightServer/worklight-ant-builder.jar"/>
</classpath>
</taskdef>