Hi all, i got a 'slight' problem here using
ant. I tried to compile a class, let's call it A.java, in a dir /home/test/a/b/c. and the A.java contains import b.B; B.java itself is at another dir, ... let's say /home/test/b, like this :
/home/test/a/b/c/A.java -> import b.B;
/home/test/b/B.java -> package b;
Using command line javac, i must use -classpath option in order to compile class A.java successfully
~/a/b/c> javac -classpath /home/test:. A.java
The result is that B.java was compiled first, and then A.java.
if i use my build.xml and ant to compile A.java, it will always generate errors :
Buildfile: build.xml
compile:
[javac] Compiling 1 source file
[javac] /home/moonblade/devel/test/packageTest/A.java:1: package a does not exist
[javac] import a.*;
[javac] ^
[javac] /home/moonblade/devel/test/packageTest/A.java:5: cannot resolve symbol
[javac] symbol : variable B
[javac] location: class A
[javac] B.test();
[javac] ^
[javac] 2 errors
The behaviour i want is that B is compiled first AUTOMATICALLY without the task's depends attribute, just like the command line javac did. But from the err msg i got, it seems that ant couldnt compile A.java because B.class doesnt exist. The ant works out fine if the B.class exists. And i really need to use ant for other purposes, so plz dont suggest me to use javac command line instead
Here is my VERY simple build.xml :
<project name="test" basedir="." default="compile">
<path id="compile.classpath">
<pathelement location="/home/test"/>
</path>
<!-- Check timestamp on files -->
<target name="prepare">
<tstamp/>
</target>
<target name="compile">
<javac srcdir=".">
<classpath refid="compile.classpath"/>
</javac>
</target>
</project>
Can anybody help me out ? :roll: