user3330426
user3330426

Reputation: 11

How to build and deploy adapter with single ANT script Worklight 6.1

At 6.1 the ant jar was split into two jars: worklight-ant-builder.jar and worklight-ant-deployer.jar. I can run the build or the deploy tasks by themselves but I have to change the fileset. I want to run the build adapter and deploy adapter out of a single ant script.

I've tried a few ways to include both jars in the taskdef fileset:

include name="*.jar"

or filename name="*.jar" or include name="worklight-ant-builder.jar" include name="worklight-ant-deployer.jar"

Its almost like the tasks won't accept multiple jars. The build always works, but the deploy only when the deployer.jar is "include name="worklight-ant-deployer.jar" by itself.

<taskdef resource="com/worklight/ant/defaults.properties">
    <classpath>
      <fileset dir="${worklight.server.install.dir}/WorklightServer">
        <include name="*.jar"/> 
         <!--   <filename name="*.jar"/> -->
       <!-- <include name="worklight-ant-builder.jar"/>  -->
       <!-- <include name="worklight-ant-deployer.jar"/>  -->           
      </fileset>
    </classpath>
  </taskdef>

I understand the multi-script answer but I think I shouldn't have to do that. This is my full script:

<?xml version="1.0" encoding="UTF-8"?>

<project name="BuildDeployAdapter" basedir="." default="help">

  <property name="worklight.server.install.dir" value="C:/IBM/Worklight61/"/>
  <property name="adapter-source-files-folder" value="C:/Worklight/workspaces/base61p/HelloWorklight/adapters/HTTPAdapter"/>
  <property name="destination-folder" value="C:/Worklight/workspaces/base61p/HelloWorklight/binANT"/>
  <property name="myAdapter.adapter" value="${destination-folder}/HTTPAdapter.adapter"/>
  <property name="http.server.port.context" value="http://mydomain:9080/worklight"/>

  <taskdef resource="com/worklight/ant/defaults.properties">
    <classpath>
      <fileset dir="${worklight.server.install.dir}/WorklightServer">
        <include name="*.jar"/>
       <!-- <filename name="*.jar"/> -->
       <!-- <include name="worklight-ant-builder.jar"/>  -->
       <!-- <include name="worklight-ant-deployer.jar"/>  -->           
      </fileset>
    </classpath>
  </taskdef>

  <target name="buildAdapter">
    <adapter-builder
        folder="${adapter-source-files-folder}"
        destinationfolder="${destination-folder}"/>
  </target>     

  <target name="deployAdapter"> 
    <adapter-deployer deployable="${myAdapter.adapter}"
                      worklightserverhost="${http.server.port.context}" 
                      userName="username" password="password" />
  </target>

</project>

Right now I have to switch the included jar for each task, when I want to use the masked include - either include name=".jar" or filename name=".jar". This seems to be a limititation on the specific task not accepting more than one jar. Am I off base here?

Upvotes: 1

Views: 829

Answers (1)

Lolo
Lolo

Reputation: 4347

Given the information you provided, it seems that a solution could be to create a separate script that would invoke the build and deploy scripts in sequence, like this:

<project name="Adapter Stuff" default="do.all" basedir=".">
  <target name="do.all">
    <ant antfile="path/to/worklight-build-adapter.xml"
         target="build-target" inheritall="false"/>
    <ant antfile="path/to/worklight-deploy-adapter.xml"
         target="deploy-target" inheritall="false"/>
  </target>
</project>

Upvotes: 1

Related Questions