1
votes

We are using IBM Worklgiht 6.0 (exact versions below) and are seeing a build error when building a Worklight project with the ANT Tasks but the same code builds just fine in Eclipse.

Here is the ANT build Error:

BUILD FAILED C:\Users\Administrator\workspace-techcon3\MyProject\build.xml:44: Failed buildin g application: com.worklight.builder.exception.WorklightBuildRuntimeException: R esource Manager - Problem reading info.plist file C:\Users\Administrator\workspa ce-techcon3\MyProject\apps\MyApp\iphone\native\MyAppIphone-Info.plist (The syste m cannot find the file specified) Nested exception: C:\Users\Administrator\works pace-techcon3\MyProject\apps\MyApp\iphone\native\MyAppIphone-Info.plist (The sys tem cannot find the file specified)

Here are the details:

  1. The Worklight project was created with the WorklightStudio plugin v6.0.0.20130926-1933 in Eclipse Juno SR2.
  2. The Worklight Project name is MyProject and it contains one hybrid app named MyApp. It contains environments for iphone and android.

  3. Everything is fine in Eclipse (builds, deploys, etc) but fails when building the same code on our CI server via ANT (see error above and build.xml snippet below).

  4. The ANT build is looking for a file called iphone\native\MyAppIphone-Info.plist but the actual file that was generated by the Worklight plugin in Eclipse that resides on the filesystem is iphone\native\MyProjectMyAppIphone-Info.plist and hence it fails:
  5. The build.xml is below.

In short, it seems the Worklight project atrtifacts created by the Worklight Eclipse plugin are not compatible when building the same code with ANT -- but seems this should work or there isn't a way to build in Eclipse for dev and do a headless build via ANT in a CI environment.

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>
1

1 Answers

2
votes

In your build.xml you are missing the nativeProjectPrefix property in the app-builder tag. Here is an example off the app-builder with the different properties.

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