MobileFirst 使用 Ant 构建项目 WAR 文件

MobileFirst Building a project WAR file with Ant

我正在尝试在 MobileFirst Platform 6.3 中使用 Ant 构建项目 .war 文件。

我的 build.xml 有以下内容:

<?xml version="1.0" encoding="UTF-8"?>
    <project name="myProject" default="all">
        <taskdef resource="com/worklight/ant/defaults.properties">
            <classpath>
                <pathelement location="/Applications/IBM/Worklight-CLI/public/worklight-ant-builder.jar"/>
            </classpath>
        </taskdef>
        <target name="all">
            <war-builder projectfolder="."
                destinationfolder="bin/war"
                warfile="bin/project.war"
            classesFolder="classes-folder"/>
       </target>
   </project>

当我执行 Ant 脚本时,它抛出以下错误:

[taskdef] Could not load definitions from resource com/worklight/ant/defaults.properties. It could not be found.

您提到您使用的是 MFP 6.3,但在您的 XML 中您指向的是 "Worklight-CLI",即 不是 MFP 6.3,而是 6.2或更老。您确定您真的在使用 MFP 6.3 吗?
它还指的是 CLI。您确定要使用 CLI 吗?在你的问题中没有提到 CLI...

  1. 确认您安装了您打算使用的正确版本
  2. 安装正确的版本后,将位置属性更改为:

location="/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/ant-tools/worklight-ant-builder.jar"