I'm having problems building my project, using an Ant script, from the command prompt using Ant itself. It can't find a certain import for a particular Java file in my project (which has nearly 5,000 source files as it is). The import is included in a .jar package whose location I have set in the Ant file itself. Oddly enough, I can build the project just fine from the Ant file using an IDE like Eclipse. Any ideas what could be wrong? Thanks!
check the basedir property. If the location of the jar in question is relative then the basedir will influence the behaviour in this peculiar way.
Or it could be that eclipse adds that jar to the classpath when it will run the ant file.
Convert the jar location to an absolute path
<property name="x" location="${jar.reference}" />
and print it
<echo message="${x}" />
My ant skills are a little rusty so you should double check the syntax :-).
Can you tell us the name of the jar? Whenever I've had this issue it has always been to do with versions of libraries used by the IDE but not in the ANT_HOME/lib directory, usually logging or xml parsing.
Which ant command is failing? java/javac? Have you tried using the fork=yes option if it is java?
Have you defined properly your classpath in Ant ? Eclipse tends to automatically compute the classpath when running ant...