Dale, > Thanks for replying. I have included a mytest.jar file > that causes the compile "all the time." problem. > > First, it's important > to know that I have some requirements that maybe Ant > doesn't support, here they are: > > #1. The classes must compile to the same directory > as the java src files. > > #2. The build.xml "must reside" in the "same directory" > as the java src files. >
#1 is OK but #2 is going to cause you some problems. I'm not sure why you have this requirement but I understand that sometimes these exist. You will need to make some changes to the build.xml to get it to work. By compiling in the de/seessle/p1, you are effectively presenting the Java source files in the root of the namespace. If you read http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javac.html, you will see that it states "You should arrange source files in a directory tree that reflects their package tree. For example, if you keep all your source files in /workspace, the source code for com.mysoft.mypack.MyClass should be in /workspace/com/mysoft/mypack/MyClass.java. " What this means in the case of the example is that you must compile from your /home/dgh1/the_ant_test directory. This is because the javac automatic compilation mechanisms rely on this. To illustrate, try this, leaving Ant aside for a moment: Make the following change to Class1.java public class Class1 { private Class3 a3 = new Class3(); } Now type javac Class1.java in the de/seessle/p1 directory (This is effectively what you are telling Ant to do). You should get something like this D:\Download\unzipped\mytest\de\seessle\p1>javac Class1.java Class1.java:5: cannot resolve symbol symbol : class Class3 location: class de.seessle.p1.Class1 private Class3 a3 = new Class3(); ^ Class1.java:5: cannot resolve symbol symbol : class Class3 location: class de.seessle.p1.Class1 private Class3 a3 = new Class3(); Now change directories to the root of the namespace hierarchy (/home/dgh1/the_ant_test in your case). and type D:\Download\unzipped\mytest>javac de\seessle\p1\Class1.java D:\Download\unzipped\mytest> No errors. What this demonstartes is that it is not just Ant that assumes your code will be organized according to the package namespace, but javac as well. So, in short, you have to get the compile to happen in the root of the namespace. In this example, try this <javac srcdir = "/home/dgh1/the_ant_test" destdir = "/home/dgh1/the_ant_test" classpath = /home/dgh1/the_ant_test"/> You should be cooking with gas. Conor
