Eclipse 未能创建任务或类型antlib:com.ibm.websphere.wlp.ant:server

Eclipse 未能创建任务或类型antlib:com.ibm.websphere.wlp.ant:server,eclipse,ant,eclipse-plugin,websphere,websphere-liberty,Eclipse,Ant,Eclipse Plugin,Websphere,Websphere Liberty,以下是WebSphere Liberty概要文件的服务器配置: 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)

以下是WebSphere Liberty概要文件的服务器配置:

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.V20130308030/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
生成失败
/opt/UIWS/UI/Liberty.xml:6:问题:无法创建任务或类型antlib:com.ibm.websphere.wlp.ant:server
原因:名称未定义。
措施:检查拼写。
操作:检查是否已声明任何自定义任务/类型。
措施:检查是否发生了任何/声明。
尚未在此命名空间中定义任何类型或任务
这似乎是一个antlib声明。
操作:检查实现库是否存在于以下之一中:
-/opt/worklight/eclipse/plugins/org.apache.ant_1.8.4.v20130308030/lib
-/root/.ant/lib
-使用-lib参数在命令行上添加的目录
总时间:445毫秒

如果需要更多信息,请告诉我。我下面是链接。

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

  • 如果要为工作区中的所有构建文件启用该任务,请通过
    Window>Preferences>Ant>Runtime
    修改工作区属性,并将
    wlp-anttasks.jar
    作为外部jar添加到
    Ant主条目
  • 如果您只想为单个构建文件启用它,那么选择
    build.xml
    ,右键单击
    runas>antbuild…
    ,然后切换到
    Classpath
    选项卡,并将
    wlp anttasks.jar
    作为外部jar添加到
    用户条目中
无论哪种情况,您的构建都将成功