0

Does anybody have an example of using JDK 6 style - only defining the directory and not list of each and every jar in the directory - classpath with an ANT javac compile task?

We tried it like this

compile.classpath=c:....\WEB-INF\lib*;...websphere...\a.jar;...websphere...\b.jar; etc. and used this classpath in the javac task, but the libraries from WEB-INF\lib were not being recognised.

So, I am wondering if it is possible to use this type of construct with ANT. The ANT version is 1.8.4.

adbdkb
  • 1,897
  • 6
  • 37
  • 66

2 Answers2

0

Typically we use path like structures .

<path id="project.classpath">
   <fileset dir="${libdirectory}">
       <include name="*.jar"/>
   </fileset>
</path>

The the project.classpath is used in javac task. See more at ant examples

Jayan
  • 18,003
  • 15
  • 89
  • 143
  • This is how the task is defined now in the working build. But this construct expands it to the complete list of jars in the directories. ( This make the classpath really big - about 5k characters ) With JDK 1.6, that is not necessary. With JDJ 1.6, we should be able to just list the directories with /* instead of listing all the jars in it. – adbdkb Sep 24 '12 at 11:12
0

I do not yet know, why this works vs. why it doesn't work without these attributes, but I was able to get the wildcard part to work by using the fork="yes" and executable="path-to-my-executable" attributes in the javac task.

adbdkb
  • 1,897
  • 6
  • 37
  • 66