Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ant: Javac and classpath - another "What am I doing wrong"

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I absolutely MUST be out of practice, because I don't recall having these problems before.

Keep in mind the structure is the same as mentioned in my other thread about deleting directories.

Here's the snipped of build.xml in the workspace/Project-Common directory.



So, basically, Project-1 requires the .jar files (there are 2 of them) in Project-Common. Project-2 requires those same .jar files, plus a .jar file in Project-2/lib, plus the classes from Project-1.

What is causing this to fail? The compilation errors happen with Project-1, and they suggest that the system is acting as if the classpath reference is simply not there.
 
author & internet detective
Posts: 41944
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think classpath is looking for jar files when using a string. You could create a directory structure in Ant that uses all the files in that directory. Take a look at the classpath ref section of this page
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That works for Project-1, where the classpath has to refer only to directories that contain .jar files.

For Project-2, one of the directories will contain classfiles from Project-1. That seems to give it fits....

Here's a sample of what I'm trying to do, without all that semi-clever antcall stuff... Note that the lib references are written as lib/**/* because I may have sub-directories with their own .jar files in there in the future.



EDIT: I'm an idiot... if I replace:


with:


then it works.

NOW I've got to try to figure a way to be clever and put that in with an antcall sort of setup...
 
Jeanne Boyarsky
author & internet detective
Posts: 41944
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for posting the answer. Seeing the intermediate step and solution will help others!
 
Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic