aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes using ant for compiling java files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "using ant for compiling java files" Watch "using ant for compiling java files" New topic
Author

using ant for compiling java files

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 126
i have java files in many packages. Such as
com\pack1\pack2\pack3\ (java files here)
com\pack1\pack2\ (java files here)
com\pack1\ (java files here)
.....
com\a\b\c\(java files here)
com\a\b\(java files here)
..

I have to give an option to the end user to compile the source files(if she ever wants to do so). So I asked this ques in EE that how can i do this without using many javac statments and putting them in a batch file. i was suggested that i should use ant.
Now I have managed to compile the source files using ant and copy other files(such as xml, xsl, jar etc) to the target directory. I do this by first navigating to the ant folder(which has build.xml file) and writing ant there. It compiles all those java files and puts them in build directory along with other needed files.
What i want to know is how can i make the end user use this. Do i have to tell her to install ant, copy build.xml file there and the source dir and navigate to it and write ant or is there a better way of doing this?

here is my build.xml



Thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Thomas Greene:
What i want to know is how can i make the end user use this. Do i have to tell her to install ant, copy build.xml file there and the source dir and navigate to it and write ant or is there a better way of doing this?

If your user is not capable enough to use Ant, why is she interested in compiling your source code?

Anyway, if that's really what you want to do (let the user build your project without having to install Ant), you can always distribute Ant along with your application.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
 
subject: using ant for compiling java files