我正在尝试构建并将我的ant build.xml中的适配器部署到MobileFirst Server上,但是当我尝试访问ant.It中的以下代码行时会抛出错误。
错误: 无法从资源加载定义 COM /工作灯/ ANT /建设者/ defaults.properties。它无法找到。
代码:
<taskdef resource="com/worklight/ant/builders/defaults.properties">
<classpath>
<pathelement
location="/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/ant-tools/worklight-ant-builder.jar" />
</classpath>
</taskdef>
答案 0 :(得分:1)
部署应用程序
我认为您的resource
值不正确。
尝试更改:
<taskdef resource="com/worklight/ant/builders/defaults.properties">
要:
<taskdef resource="com/worklight/ant/defaults.properties">
我已经使用以下脚本进行了测试,它对我有用:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="target-name">
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/ant-tools/worklight-ant-builder.jar"/>
</classpath>
</taskdef>
<target name="target-name">
<app-builder
worklightserverhost="http://my-ip-address:10080"
applicationFolder="/Users/idanadar/Documents/MobileFirst/Eclipses/workspaces/6300/my-project-name/apps/my-app-name"
environments="common,iphone"
nativeProjectPrefix="my-project-name"
outputFolder="/Users/idanadar/Desktop"/>
</target>
</project>
注意:构建器.jar文件的路径应该是as stated in the documentation,但对我来说,至少我收到了相同的错误,除非使用问题中提到的相同路径。 / p>
部署适配器
尝试使用以下模板(使用您自己的模板更改所需的值):
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="target-name">
<taskdef resource="com/worklight/ant/deployers/antlib.xml">
<classpath>
<!-- Change this to the path of the worklight-ant-deployer.jar available in the
server installation folder -->
<pathelement location="/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/worklight-ant-deployer.jar"/>
</classpath>
</taskdef>
<target name="target-name">
<!-- if your console is secure, remove the 'secure="false"' attribute -->
<wladm url="my-ip-address:10080/worklightadmin" secure="false" user="admin" password="admin">
<deploy-adapter runtime="my-project-name" file="my-adapter-name.adapter"/>
</wladm>
</target>
</project>