I wrote a bash shell that runs a java application. To automatize the process I want to first add ant to build the java application. However, I don't want to rebuilt the existing application if there aren't any changes in *java files. I'm lost as what is a good way to do this.
2 Answers
The Ant javac task does exactly that:
Compiles a Java source tree.
The source and destination directory will be recursively scanned for Java source files to compile. Only Java files that have no corresponding .class file or where the class file is older than the .java file will be compiled.
So just create a buildfile that uses javac and have the bash script call Ant to compile before running the application. You can also use Ant itself to run the application by using the java task.
2 Comments
src element if you're already using the source="${source}" attribute.Javac task of ant should be doing exactly that. Can check the answer to the question link below which provides little more detail