Eclipse and Ant Build: deploy everything with!


Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.

Ant (Apache Ant) is a software tool designed to automate software build processes. It is kind of and advanced “make” tool but Ant Build is written in Java and itself requires a Java platform, and is best suited to building Java projects.

But Ant Build isn’t just to build and deploy Java projects. Also it can be used to deploy everything with!

Here’s an Oracle Database example project :
You might have implemented a litte new release on the departements application. So let’s name it. We call this project: “Dep2.2”
This is what’s included in Dep2.2 :
2.2.A.1: new sql script: dep2.2_alter_department_table.sql
2.2.A.2: new sql script: dep2.2_insert_department_data.sql
2.2.A.3: new sql script: dep2.2_transfer_employees.sql
2.2.B.1: new oracle forms: dep_department_s_fmb
2.2.B.2: new oracle forms: dep_employee_s_fmb
2.2.B.3: new oracle forms: dep_metadata_s_fmb
2.2.B.4: new oracle forms: dep_department_list_s_fmb
2.2.C.1: new oracle reports: dep_department_list_r.rdf
2.2.C.2: new oracle reports: dep_dep_employee_list_r.rdf

So I have to run the sql scripts, compile the forms and reports, deploy the binary files to its rumtime directories ….
All this word should be done on each stage: developement-, test- and production-environment.
So lets calculate: 9 scripts, 2 deployments, 3 stages: 9 * 2 * 3 = 54 steps.
By hand, this is pretty much work to do. And it’s boring because I do the same all the time.

This 54 steps can be automated with Ant Build and Eclipse!

Here’s what you have to do:

Your local Filestructure :

P:\dev_build
Personal deployment direcotry. Ant BUILD.XML files will allway delete this directory before redeploy into.

P:\dev_config
Person configuration directory to save Ant Build Properties and Ant Build Files in general.

P:\dev_vss
Personal source directory. Can be the Source-Control working directory for example.

Create the Ant Build config files (xml):

P:\dev_config\build.user.properties
# ====================
# DB Connection:
#
oracle.user = user1111
oracle.target = myDatabase
Create an Ant Build script (xml):

<project name=” release Dep2.2″ default=”build” basedir=”p:\dev_vss\“>
<property file=”p:\dev_config\build.user.properties”/>
<property name=”build.release” value=”2.14″/><property name=”build.sqlmasterfile” value=”_create.sql”/>
<property name=”workspace.dev_config” location=”p:\dev_config“/>

<property name=”workspace.root” location=”p:\dev_vss\“/>

<property name=”workspace.build” location=”${workspace.root}\releases\release 2.14″/>

<property name=”workspace.scripts” location=”${workspace.root}\scripts”/>

<property name=”workspace.source” location=”${workspace.root}\source”/>

<property name=”workspace.forms” location=”${workspace.root}\forms”/>

<property name=”workspace.reports” location=”${workspace.root}\reports”/>

<property name=”workspace.data” location=”${workspace.root}\data”/>
<property name=”build.root” location=”p:\dev_build“/>

<property name=”build.files” location=”${build.root}\files”/>

<property name=”build.zip” value=”${ant.project.name} ${build.release}.zip”/>

<target name=”build”

description=”(MASTER) Runs all nessessary.”

depends=”cleanBuild”>

<echo message=”Starting BUILD ….. Connection: ${oracle.user}@${oracle.target}”/>

<antcall target=”copyMisc”/>

<antcall target=”copySource”/>

<antcall target=”copyReports”/>

<antcall target=”copyForms”/>

<antcall target=”deployToDatabase”/>

<antcall target=”compileForms”/>

</target>
<target name=”copyMisc” description=”copies diff. files.”>

<copy todir=”${build.files}” file=”${workspace.build}/_create.sql”/>

<copy todir=”${build.files}” file=”${workspace.scripts}/compile.sql”/>

<copy todir=”${build.files}” file=”${workspace.dev_config}/compile_fmb.bat“/>

<copy todir=”${build.files}” file=”${workspace.dev_config}/set_environment.reg“/>

</target>

…. and run it against each environment stage (developement, testing, production).

Tip: When getting an Ant Build error (no parameter window, or kind of this) then try to:
– right click on the build.xml file
– click on “Run Ant”
– On the “modify attributes and launch” dialogue click on the JRE tab.
– Runtime JRE: Choose “Run in the same JRE as the workspace”.
– Close
… and rund the Ant Build again.

1 thought on “Eclipse and Ant Build: deploy everything with!”

  1. Hi

    I’m also regular do manual patches of Oracle forms, sql, plsql, pro*C and ksh files on unix which have dependencies on the order of compiling and am looking at Ant to see if it can ease the task of deploying across environments.

    I think your example is missing the ant tasks that define how to do the compile of forms and compile.sql

    Would you be able to share the complete script or at least give a pointer on what this looks like ?

    I gather from the above that you are coping the scripts into the config directory and I assume there would then be a

    but i’m unclear what needs to go inside – I have an environment file that is normally sourced before running the forms compile to set the various forms environment such as FORMS_PATH, ORACLE_HOME etc.. which may differ on each environment

    I’d then use a shell script that runs frmcmp with parameters module= userid= module_type=form but i’m not clear how to specify this in the ant build.xml

    Do I have to hard code them each time for a specific build or can this be generic with ant so I can specify the type of files that need to be processed and let it run on each file type in the src directory ?

    Thanks

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top