Ant does not recognize classpath

I do not understand why this Ant task does not work:

<javac srcdir="src" destdir="bin" verbose="true" classpath="lib/*;${MyCommons.proj.path}/MyCommons.jar" /> 

My banks are all in lib, plus one external bank. When I am over the classpath section, an eclipse shows that all jar files are recognized by this configuration.

When compiling, I get 100 errors that cannot find this package or symbol (it does not find banks).

 [javac] Compiling 51 source files to C:\MyProjects\MyCommons\bin [javac] C:\MyProjects\MyCommons\src\com\proxyandvpn\datamodel\Notification.java:3: package org.joda.time does not exist [javac] import org.joda.time.DateTime; [javac] ^ [javac] C:\MyProjects\MyCommons\src\com\proxyandvpn\datamodel\Transaction.java:5: package org.joda.time does not exist [javac] import org.joda.time.DateTime; 

I tried every classpath format I can find, classpathref's, embedded, filesets, fileslists, etc. In one hour.

Does anyone see a mistake?


Before this call, I have a call

 <ant target="compile" dir="/some/other/project"/> 

Removing this option allowed the javac command to compile successfully.

+4
source share
2 answers

you should try this (did not start, but I think it works):

 <path id="some.classpath"> <fileset dir="lib"> <include name="*.jar"/> </fileset> <pathelement location="${MyCommons.proj.path}/MyCommons.jar"/> </path> 

and then

 <javac srcdir="src" destdir="bin" verbose="true"> <classpath refid="some.classpath"/> </javac> 

If there are errors, add them to the comments. I will fix it.

+2
source

I had the same problem. It helps me:

 <ant target="compile" dir="/some/other/project" inheritAll="false"/> 
+1
source

All Articles