我們正在使用IBM Worklgiht 6.0(以下確切版本),並且在構建具有ANT任務但同一代碼的Worklight項目時看到構建錯誤在Eclipse中構建得很好。IBM Worklight:使用ANT任務構建Worklight項目時出現構建錯誤,但它構建在Eclipse中
這裏是Ant構建錯誤:
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)
下面是詳細信息:
- 工作燈項目在Eclipse中朱諾SR2的WorklightStudio插件v6.0.0.20130926-1933創建。
Worklight項目名稱是MyProject,它包含一個名爲MyApp的混合應用程序。它包含iphone和android的環境。當我們在CI服務器上通過ANT構建相同的代碼時(見上面的錯誤和下面的build.xml代碼片段),Eclipse中的一切都很好(構建,部署等),但是失敗。
- Ant構建正在尋找一個文件名爲iphone \本地\ MyAppIphone-Info.plist中但被在Eclipse駐留文件系統上的工作燈插件生成實際的文件是iphone \本地\ MyProjectMyAppIphone- Info.plist因此它失敗:
- build.xml如下。
簡而言之,Worklight Eclipse插件創建的WorkTemplate似乎與ANT構建相同的代碼時不兼容 - 但似乎這應該工作,或者在Eclipse中無法構建開發並通過ANT在CI環境中進行無頭構建。
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>