无法创建任务或键入antlib:com.ibm.websphere.wlp.ant:server

时间:2014-10-03 13:53:11

标签: eclipse ant eclipse-plugin websphere websphere-liberty

以下是WebSphere Liberty Profile的服务器配置:

product = WebSphere Application Server 8.5.5.1
wlp.install.dir = /opt/IBM/WebSphere/Liberty/
java.home = /root/Downloads/jre1.6.0_45
java.version = 1.6.0_45
java.runtime = Java(TM) SE Runtime Environment (1.6.0_45-b06)
os = Linux (2.6.32-431.23.3.el6.x86_64; amd64) (en_US)

我已复制" wlp-anttasks.jar"到" /opt/worklight/eclipse/plugins/org.apache.ant_1.8.4.v201303080030/lib"位置并在ant任务之后运行以启动Liberty服务器:

<project basedir="." xmlns:wlp="antlib:com.ibm.websphere.wlp.ant">
    <property name="wl.server.home" value="/opt/IBM/WebSphere/Liberty"/>
    <property name="wl.server.name" value="WL_UAT_Server"/>

    <target name="test">
      <wlp:server id="test" installDir="${wl.server.home}" operation="start" serverName="${wl.server.name}"/>
    </target>
</project>

执行后,它给我以下错误:

BUILD FAILED
/opt/UIWS/UI/Liberty.xml:6: Problem: failed to create task or type antlib:com.ibm.websphere.wlp.ant:server
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.
No types or tasks have been defined in this namespace yet

This appears to be an antlib declaration. 
Action: Check that the implementing library exists in one of:
        -/opt/worklight/eclipse/plugins/org.apache.ant_1.8.4.v201303080030/lib
        -/root/.ant/lib
        -a directory added on the command line with the -lib argument


Total time: 445 milliseconds

如果需要更多信息,请告诉我。我正在关注this链接。

1 个答案:

答案 0 :(得分:1)

如果直接从Eclipse开始构建,我相信它不会自动添加eclipse/plugins/org.apache.ant_1.8.4.v201303080030/lib文件夹中的所有jar。最好手动提供它。

  • 如果要在工作区中为所有构建文件启用任务,则通过Window > Preferences > Ant > Runtime修改工作区属性,并将wlp-anttasks.jar作为外部jar添加到{{1 }}
  • 如果您只想为单个构建文件启用,请选择Ant Home Entries,右键单击build.xml,然后切换到Run As > Ant build ...标签,将Classpath作为外部jar添加到wlp-anttasks.jar

在任何一种情况下,您的构建都会成功。