| Author |
Ant usage
|
Kiran Baratam
Greenhorn
Joined: Sep 03, 2003
Posts: 27
|
|
Hi all I am new to Ant and i heard that ant can be used as a build tool but never worked on it and would like to write know certain things. i am working on a project which uses some jar files which are required to run the application. i would like to make a directory as c:/production/execute/ and copy all the jar required to run and these jar are avilable in c:/lib/. my java files are in c:/com/info/stock i want to compile the jave files in this directory and copy to above directory i.e c:/production/execute/com/info/stock First i would like to know whether ant is ment for doing things like this and if so can some body help me in doing this. i installed ant in my machine. Please help me.
|
 |
Andres Gonzalez
Ranch Hand
Joined: Nov 27, 2001
Posts: 1561
|
|
Kiran - This is exactly what Ant is for . Since you're new to Ant, I'd recommend you to start with basic things, like compiling and creating your own targets. The Ant tutorial is what you need to get into speed. Once you understand, look at all the options that Ant has to copy files, delete/clean directories, etc. If you have any specific question let us know.. HTH
|
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
|
 |
Kiran Baratam
Greenhorn
Joined: Sep 03, 2003
Posts: 27
|
|
Hi Andres Thanks for the reply. I am going through the turorial and trying out some small examples. I could able to compile and create directory as i need. Actuall i had taken a sample file and started working on it. i have a small doubt. in the file i had take there is a line like below <target name="clean" description="Delete build files"> <delete dir="${build}" /> what does it do??? i did not find any activity by these lins.I tried by removinf also. Can you please let me know. Regards Kiran
|
 |
Juanjo Bazan
Ranch Hand
Joined: Feb 04, 2002
Posts: 231
|
|
That delete task is suposed to be used to remove any temp. directory used in previous tasks(the diretory defined in "build"). Notice that if the target "clean" is not invoked it will not execute, maybe thats why you don't see any activity related with it. HTH Juanjo
|
 |
Kiran Baratam
Greenhorn
Joined: Sep 03, 2003
Posts: 27
|
|
Hi Here is my build.xml. i am able to compile and copy the classes in specified directory.I did not understand why delete option is not working.am i missing some thing?? Please help me. Regards Kiran <project name="AntExample" default="compile" basedir="."> <!-- Set the source directory from where the java files need to be taken --> <property name="src" location="./com/chase/impb/tokyo/matrix2/automate" /> <!-- Set the destination directory where the class files need to be copied --> <property name="build" location="d:/DINO_Test/cfunds" /> <!-- Set all the dependency jar/class files directory --> <property name="lib" location="lib" /> <!-- Load local and user build preferences --> <!-- Specify dependent jars and their locations which are not avilable in lib directory --> <property file="${user.home}/build.properties" /> <property file="build.properties" /> <!-- Set compile classpath --> <path id="compile.classpath"> <fileset dir="${lib}"> <include name="**/*.jar" /> </fileset> <!-- list the jars which are not avilable in lib directory insted in a different place specified in properties file --> <pathelement location="${iText.jar}" /> </path> <!-- targets --> <target name="compile" description="Compile the source and copy resource files."> <mkdir dir="${build}" /> <!-- Specify the command you want to execute on the source directory with class path if needed --> <javac srcdir="${src}/java" destdir="${build}"> <classpath refid="compile.classpath" /> </javac> <copy todir="d:/DINO_Test/cfunds" includeEmptyDirs="no"> <fileset dir="${src}/resources" /> </copy> </target> <target name="clean" description="Delete build files"> <delete dir="${build}" /> </target> </project>
|
 |
Andres Gonzalez
Ranch Hand
Joined: Nov 27, 2001
Posts: 1561
|
|
try: Disclaimer: I have NOT tested it. [ October 05, 2003: Message edited by: Andres Gonzalez ]
|
 |
 |
|
|
subject: Ant usage
|
|
|