0

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!

4

3 回答 3

0

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 :-).

于 2009-05-18T15:04:20.123 回答
0

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?

于 2009-05-18T15:05:30.340 回答
0

您是否在 Ant 中正确定义了类路径?Eclipse 在运行 ant 时倾向于自动计算类路径...

于 2009-05-18T15:10:00.377 回答