I get a task of ant. The background information is, I get delivery(i.e. delivery.zip) from R/D every some days. The delivery includes all src, lib, mysql-db-dump.csv, an ant build.xml which can compile source code in a temporary folder (./build) and save the final result (all war, jar, classes) into another folder (./bin). After that, my task is to forward the delivery to our customers who want to get all the source code and possibility to create all components of the product by themselves. So, I try to write an ant file to realize it and my solution separates the work into 4 steps.
First of all, I need a core_ant_build.xml which looks like
<project name="core_ant" default="build" basedir="."> <target name="build"> <ant antfile="configure_environment.xml"> <!-- 1 --> <ant antfile="build.xml"> <!-- 2 --> <ant antfile="distribute.xml"> <!-- 3 --> <ant antfile="restart_system.xml"> <!-- 4 --> </target> </project>
The 1st step -- configure_environment.xml
it setups all global variables.
i.e.
JAVA_HOME
ANT_HOME
DELIVERY_HOME
TOMCAT_HOME
JBOSS_HOME
IP_ADDRESS
PORT_NUMBER
...
..
.
all directories' style are in linux (like /, /usr/local/ant). I permit the customers invoking the building process from windows side, so, I must put those xml files together with the extracted delivery folder into a Share directory so that they can be accessed from both Linux and Windows sides.
How to predefine these global variables in order that the next three xml files can get the information ?
Also, it has to configure some xml files which contain url and port number. i.e. if a xml file contains http://localhost:8080/Interface/interface, it must replace it into http://IP_ADDRESS:PORT_NUMBER/Interface/interface (IP_ADDRESS and PORT_NUMBER are defined in the first step).
The 2nd step -- build.xml
This is exact the build.xml file in the delivery fold from R/D. Hence, I will not touch it. I just want my core_ant_build.xml file can call it in order to get all war and jar files in the ./bin folder.
The 3rd step -- distribute.xml
It executes "mysql -Dmydb mysql-db-dump.csv" to refresh the database.
It copies all *.jar files into JBOSS_HOME/server/default/deploy .
It copies all *.war files into TOMCAT_HOME/webapps (i.e. if ./aaa folder exists when it copies aaa.war to the folder, it would delete the fold ./aaa in order to deploy the new aaa.war correctly)
The 4th step -- restart_system.xml
In the linux server side, It stops JBoss, TomCat, MySQL and restart MySQL, TomCat JBoss consequently.
The target is, once the customers get my delivery, if it is the first time, they must configure the core_ant_build.xml and create an execute_ant.sh, so that my core_ant_build.xml could get all environment variables. after that, the customers will simply execute the execute_ant.sh, it will automatically build the system, deploy the system and restart the system.
Will you please show me your opinion? Because I have not grasped the whole ant, some of my idea must be very naive and stupid. Please take a look and reply me ur solution.
with best wishes
Sun Zheng
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
