在 mobilefirst ant 构建中控制 wlServerContext

controlling the wlServerContext in mobilefirst ant builds

我想使用 ant 构建 MobileFirst 工件,但我无法在 wlclient.properties 文件(Android ) 或 worklight.plist 文件 (iOS).
在这两种情况下,它都是 /,我想要 /MyProject/ - 这是 mfp build 设法产生的结果。

这是我正在使用的 ant 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project default="mfp-ant-build" basedir="/Users/sean/Development/MyProject">
  <taskdef resource="com/worklight/ant/defaults.properties">
    <classpath>
      <pathelement location="/Applications/IBM/MobileFirst-CLI/public/worklight-ant-builder.jar" />
    </classpath>
  </taskdef>
  <target name="mfp-ant-build">
    <war-builder projectfolder="${basedir}" classesFolder="bin/classes" destinationfolder="../build/dist/servers/mfp-ant-build-local/tmp" warfile="../build/dist/servers/mfp-ant-build-local/MyProject.war" />
    <app-builder nativeProjectPrefix="MyProject" applicationFolder="apps/MyApp" worklightserverhost="https://myserver/" outputFolder="../build/dist/servers/mfp-ant-build-local" />
  </target>
</project>

我还需要做什么?

FWIW:

$ mfp --version
7.0.0.00.20150608-1402
$

我相信上下文根(您尝试中丢失的部分)应该是 worklightserverhost 属性.

的一部分

基于 Ant builder task documentation(查看最底部的示例),这是一个示例 Ant 任务:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir=".">
  <taskdef resource="com/worklight/ant/defaults.properties">
    <classpath>
      <pathelement location="/Applications/IBM/MobileFirst-CLI/public/worklight-ant-builder.jar"/>
    </classpath>
  </taskdef>
  <target name="myTestTarget">
    <app-builder
        worklightserverhost="http://localhost:10080/demoproject"
        applicationFolder="apps/demoapp"
        environments="android,iphone"
        nativeProjectPrefix="demoproject"
        outputFolder="~/Desktop"/>
  </target>
</project>