我们正在使用IBM Worklgiht 6.0(下面的确切版本),并且在使用ANT Tasks构建Worklight项目时看到了构建错误,但是相同的代码在Eclipse中构建得很好。
这是ANT构建错误:
建立失败 C:\ Users \ Administrator \ workspace-techcon3 \ MyProject \ build.xml:44:构建失败 g application:com.worklight.builder.exception.WorklightBuildRuntimeException:R 资源管理器 - 问题阅读info.plist文件C:\ Users \ Administrator \ workspa CE-techcon3 \ MyProject的\ APPS \ MyApp的\ iPhone \本地\ MyAppIphone-的Info.plist (系统 m找不到指定的文件)嵌套异常:C:\ Users \ Administrator \工作 步伐-techcon3 \ MyProject的\ APPS \ MyApp的\ iPhone \本地\ MyAppIphone-的Info.plist (系统 tem找不到指定的文件)
以下是详细信息:
Worklight项目名称是MyProject,它包含一个名为MyApp的混合应用程序。它包含iphone和android的环境。
Eclipse中的一切都很好(构建,部署等),但是在我们的CI服务器上通过ANT构建相同的代码时会失败(请参阅上面的错误和下面的build.xml片段)。
简而言之,在使用ANT构建相同代码时,Worklight Eclipse插件创建的Worklight项目atrtifacts似乎不兼容 - 但似乎这应该可行,或者没有办法在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>
答案 0 :(得分:2)
在build.xml中,您缺少app-builder标记中的nativeProjectPrefix属性。 以下是具有不同属性的app-builder的示例。
<app-builder
worklightServerHost="http://server-address:port"
applicationFolder="adapter-source-files-folder"
environments="list-of-environments"
nativeProjectPrefix="project-name"
outputFolder="output-folder"/>