本文介绍了使用 Ant Builder 构建和部署 IBM MobileFirst Platform 6.3 适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的 ant build.xml 构建适配器并将其部署到 MobileFirst Server,但是当我尝试访问 ant 中的以下代码行时,它会引发我的错误.

I am trying build and deploy adapters from my ant build.xml on to MobileFirst Server,but when i am trying to access the below lines of code in ant.It throws me an error.

错误:无法从资源加载定义com/worklight/ant/builders/defaults.properties.找不到.

Error: Could not load definitions from resource com/worklight/ant/builders/defaults.properties. It could not be found.

代码:

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

推荐答案

部署应用程序

我认为您的 resource 值不正确.

I believe your resource value is incorrect.

尝试改变:

<taskdef resource="com/worklight/ant/builders/defaults.properties">

致:

<taskdef resource="com/worklight/ant/defaults.properties">

我已经使用以下脚本进行了测试,它对我有用:

I have tested with the below script and it worked for me:

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

注意: builder .jar 文件的路径应该是 如文档中所述,但是对我来说,至少我收到了相同的错误,除非使用与上述相同的路径在问题中.

Note: The path to the builder .jar file should be as stated in the documentation, however for me at least I received the same error unless using the same path as mentioned in the question.


部署适配器

尝试使用以下模板(使用您自己的模板更改所需的值):

Try with the below template (change the required values with your own):

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

这篇关于使用 Ant Builder 构建和部署 IBM MobileFirst Platform 6.3 适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:14