Reputation: 1171
A simple question for any Eclipse project using Ant.
In the Ant configuration for my project's build.xml
(Right click on build.xml
> Run as... > Ant build...), in the Classpath tab, I add the JARs I need. When executing the build, during the javac
task, the JARs' classes and packages are not found.
Why? Does javac
only takes the classpath given by the task's <classpath>
subelement? Then what is the use of the Ant configuration classpath?
Upvotes: 0
Views: 261
Reputation: 9776
The classpath selected in the "run as" section is the classpath available to Ant while Ant is running, NOT the classpath available to javac. This used to be included in the javac classpath in older versions of Ant, but is a bad practice that should be avoided. The purpose of having an Ant script is so you can have fine control over the classpath and reproduce your builds in other environments. Having the classpath set via "mystery" Eclipse settings is counter-productive to that goal.
Upvotes: 1