Sample Build & Deployment script for Ant

Posted on 2003-11-10
Last Modified: 2013-11-22
I want to have sample build and deployment script for Ant. The build part should include activities in following sequence
1. getting the files of required version from PVCS,
2. compiling,
3. Unit test,
4. deploying java and web resources on server,
5. Stopping Websphere Application server,
6. creating JDBC connection to database and deploying Stored proc, views etc.
7. Starting Websphere Application server.
8. Generating log file.
9. E Mail log file.

If not all the activites are included, you can send the script covering as much activities as possible.
Question by:satishchannawar
  • 5
LVL 86

Expert Comment

Comment Utility
...and I want to have my house repainted. When can you come round and do it?
LVL 15

Expert Comment

Comment Utility
LOL ;-)
LVL 15

Expert Comment

Comment Utility
The usual applies.  Pos what you've done so far and we'll try to help, but we can't do the whole thing for you.
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline


Author Comment

Comment Utility
Send me the address and return ticket, I'll come and paint it for FREE.

Man you did not read the question properly, I said SAMPLE SCRIPT. I did not expect you to write the script for you, but if you have any in your REPOSITORY to innlude these or any of the existing you can send it.

Hi Jimmack

I've done Build that compiles, does unit test and create zip file of the required code and dependencies including database scripts. I'd like to include Get the relavent data from PVCS of required version before what I've done and subsequently create JDBC connection to deploy sql scripts and restart webspehere. if you have tips, do send.
LVL 15

Accepted Solution

jimmack earned 250 total points
Comment Utility
;-)  I was also considering applying for the painting contract, but I would have charged some EE points ;-)

The Ant docs for the PVCS task seem to be quite reasonable and include a couple of examples, eg:

  <!-- =================================================================== -->
  <!-- Get the latest version                                              -->
  <!-- =================================================================== -->
  <target name="getlatest">
    <pvcs repository="/mnt/pvcs" pvcsproject="/myprj"/>

You'll just need to make sure you've got the appropriate jakarta-ant...-optional.jar file installed.

Here's an (edited) example from one of my build.xml files that cleans a database (this is done before the script runs all the unit tests that refill the tables):

  <target name="cleandatabase">
    <sql driver=""
      DELETE FROM otherTable WHERE id IS NOT NULL;
      DELETE FROM thirdTable WHERE id IS NOT NULL;

Hope that helps ;-)
LVL 15

Expert Comment

Comment Utility
Sorry, forgot to include the following on that last post (regarding the database access)

This is only an example to show you how I connect to my database.  Just replace the SQL as you see fit ;-)
LVL 15

Expert Comment

Comment Utility
You probably want the <Exec> task in order to restart WebSphere.

The problem you might have here is if the WebSphere server is not on your local machine.  If it isn't, you should probably create a script/batch file that resets the server and then call that from Exec.

Not sure what you mean by "Generating log file"

The <Mail> task can be used to send an e-mail (including attachments if you want)

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
strDist challenge 35 84
maven java path setting 5 49
Java array passed to SQL where clause 23 39
mockito example issue 8 30
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now