【问题标题】:IBM Worklight: Build error when building Worklight project with ANT task but it builds in EclipseIBM Worklight:使用 ANT 任务构建 Worklight 项目时出现构建错误,但它是在 Eclipse 中构建的
【发布时间】:2013-11-21 20:24:04
【问题描述】:

我们使用的是 IBM Worklgiht 6.0(具体版本如下),在使用 ANT Tasks 构建 Worklight 项目时出现构建错误,但相同的代码在 Eclipse 中构建得很好。

这是 ANT 构建错误:

构建失败 C:\Users\Administrator\workspace-techcon3\MyProject\build.xml:44:构建失败 g 应用程序:com.worklight.builder.exception.WorklightBuildRuntimeException:R 资源管理器 - 读取 info.plist 文件 C:\Users\Administrator\workspa 时出现问题 ce-techcon3\MyProject\apps\MyApp\iphone\native\MyAppIphone-Info.plist (系统 m 找不到指定的文件)嵌套异常:C:\Users\Administrator\works 步伐-techcon3\MyProject\apps\MyApp\iphone\native\MyAppIphone-Info.plist (系统 tem 找不到指定的文件)

以下是详细信息:

  1. Worklight 项目是使用 Eclipse Juno SR2 中的 WorklightStudio 插件 v6.0.0.20130926-1933 创建的。
  2. Worklight 项目名称为 MyProject,它包含一个名为 MyApp 的混合应用程序。它包含 iphone 和 android 的环境。

  3. 在 Eclipse 中一切正常(构建、部署等),但在通过 ANT 在我们的 CI 服务器上构建相同代码时失败(参见上面的错误和下面的 build.xml sn-p)。

  4. ANT 构建正在寻找一个名为 iphone\native\MyAppIphone-Info.plist 的文件,但由驻留在文件系统上的 Eclipse 中的 Worklight 插件生成的实际文件是 iphone\native\MyProjectMyAppIphone-Info.plist,因此失败:
  5. build.xml 如下。

简而言之,在使用 ANT 构建相同的代码时,Worklight Eclipse 插件创建的 Worklight 项目属性似乎不兼容——但似乎这应该可以工作,或者没有办法在 Eclipse 中为 dev 构建并执行在 CI 环境中通过 ANT 进行无头构建。

build.xml is below:

<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="MyTask" basedir="." default="build">
    <property file="build.properties"/>

    <target name="init">
        <delete dir="${build.dir}"/>
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.dir}/classes"/>
        <echo message="Loading ANT Tool"/>
        <echo message="Basedir is ${basedir}"/>
        <echo message="Antlib is ${ant.library.dir}"/>

<taskdef resource="com/worklight/ant/defaults.properties">
            <classpath>
            <pathelement location="${ant.library.dir}/worklight-   ant.jar"/>
            </classpath>
        </taskdef>
    </target>


    <target name="build" depends="init, warBuilder,appBuilder">
        <echo message="Build Target Complete"/>
    </target>

    <target name="warBuilder">
        <echo message="Building the war file"/>
<war-builder projectfolder="${basedir}" destinationfolder="${build.dir}"
<warfile="${build.dir}/${war.file.name}" classesFolder="${build.classes.dir}"/>

<echo message="Updating the war file with worklight server configurations"/>
        <war destfile="${build.dir}/${war.file.name}" update="true">
            <webinf dir="${build.files.dir}" includes="i*.xml"/>
        </war>
    </target>

<target name='appBuilder' >
        <echo message="Building the App"/>
<app-builder applicationFolder="${apps.dir}" outputfolder="${build.dir}"
worklightServerHost="${WLSERVERHOST}"/>
            </target>


<target name='buildAllAdapters'>
        <taskdef resource="net/sf/antcontrib/antlib.xml">
            <classpath>
            <pathelement location="${ant.library.dir}/ant-contrib-0.6.jar"/>
            </classpath>
        </taskdef>

        <echo message="Building all adpaters"/>
    <foreach target="adapterBuilder" param="adapterDirectory" inheritall="true">
            <path>
                <dirset dir="${adapters.dir}">
                    <include name="*"/>
                </dirset>
            </path>
        </foreach>
    </target>
    <target name="adapterBuilder">
        <echo message="Building adapters in folder ${adapterDirectory}"/>
    <adapter-builder folder="${adapterDirectory}" destinationfolder="${build.dir}"/>
    </target>

    <target name="appDeployer">
        <echo message="Deploying app ${appFile}"/>
    <app-deployer worklightServerHost="${WLSERVERHOST}" deployable="${appFile}"/>
    </target>
    <target name='deployAllAdapters'>
        <taskdef resource="net/sf/antcontrib/antlib.xml">
            <classpath>
        <pathelement location="${ant.library.dir}/ant-contrib-0.6.jar"/>
            </classpath>
        </taskdef>

        <echo message="Deploying all adpaters"/>
        <foreach target="adapterDeployer" param="adapterFile" inheritall="true">
            <path>
                <fileset dir="${build.dir}">
                    <include name="*.adapter"/>
                </fileset>
            </path>
        </foreach>
    </target>

</project>

【问题讨论】:

    标签: ant ibm-mobilefirst worklight-studio


    【解决方案1】:

    在您的 build.xml 中,您缺少 app-builder 标记中的 nativeProjectPrefix 属性。 这是一个具有不同属性的应用程序构建器示例。

    <app-builder
        worklightServerHost="http://server-address:port"
        applicationFolder="adapter-source-files-folder"
        environments="list-of-environments"
        nativeProjectPrefix="project-name"
        outputFolder="output-folder"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-04
      • 1970-01-01
      • 2011-11-02
      • 2013-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多