loading...empty;done;/ant-task-plugin/:-uriAnt Task Plugin | iNET.elastic Dev Docs

Ant Task Plugin

Apache Ant is an open-source Java-based software tool for the build processes automation. It supplies many built-in tasks allowing to compile, assemble, test and run Java applications. Ant is an extremely flexible building tool, which does not force you to use any specific coding rules, directories layout, etc.

So, to deploy your Java applications into the platform with the help of Apache Ant, perform the following steps:

1. Install the Apache Ant build tool and Ivy manager.

2. To add the Ant Task plugin by the platform, build jar from the files in the linked repository and add it to the /lib-task folder of your Apache Ant.

3. Add the ivy.xml file to your Java project to define tasks used in your build file and manage dependencies. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<ivy-module version="2.0">
    <info organisation="com.iNET.elastic" module="iNET.elastic-ant-task"/>
    <dependencies>
        <dependency org="com.google.code.gson" name="gson" rev="2.8.1"/>
        <dependency org="org.apache.httpcomponents" name="httpcore" rev="4.4"/>
        <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.4"/>
        <dependency org="org.apache.httpcomponents" name="httpmime" rev="4.3.4"/>
        <dependency org="commons-codec" name="commons-codec" rev="1.4"/>
        <dependency org="commons-logging" name="commons-logging" rev="1.1.1"/>
    </dependencies>
</ivy-module>

4. Create the build.xml task for deployment and specify your PaaS account credentials inside. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="PaaS Test Task Deploy" basedir="." default="deploy">
 
    <property name="lib.dir" value="lib"/>
    <property name="ivy.default.ivy.user.dir" value="${basedir}/lib"/>
    <property name="ant.lib.task" value="${basedir}/lib-task/"/>
 
    <path id="lib.path.id">
        <fileset dir="${lib.dir}"/>
        <fileset dir="${ant.lib.task}"/>
    </path>
 
    <target name="deploy" description="Use the Task">
        <ivy:retrieve pattern="${lib.dir}/[artifact].[ext]" type="jar" />
 
        <taskdef name="iNET.elastic" classname="com.iNET.elastic.iNET.elastic" classpathref="lib.path.id"/>
        <iNET.elastic email="<!-- account_email -->"
                  password="<!-- account_password-->"
          dir="<!-- target_directory -->"
                  filename="<!-- deployment_archive -->"
                  context="<!-- project_context -->"
          environment="<!-- environment_name -->"
          apihoster="<!-- hoster_domain -->"
                >
        </iNET.elastic>
    </target>
</project>

Now, you can deploy your Java project with Ant and it will be automatically added to your environment.

What’s next?