我正在使用workklight 6.2并编写了以下ant任务来在linux机器命令行上构建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>
当我使用以下命令&#34; ant -f /opt/MyWS/MyProject/build.xml&#34; build-war &#34;执行任务时它给了我以下错误:
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 设置为&#34; /opt/IBM/Worklight/tools/apache-ant-1.8.4 &#34;。当我在eclipse中执行相同的任务时,它运行正常。
答案 0 :(得分:0)
似乎没有正确设置jar文件的路径(你错过了根斜杠):
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="/opt/IBM/Worklight/WorklightServer/worklight-ant-builder.jar"/>
</classpath>
</taskdef>