• 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 is running an out-of-date task class -- why?

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a small Java program which populates database tables with test data. I am running this program from Ant using a <taskdef> in the target. I launch this Ant task with Eclipse using the External Tools button.

I have recently updated the Java class in order to add different test data to the tables. However now when I run the Ant task the old class gets executed and the old test data is inserted into my database tables. This happens no matter how many times I restart Eclipse or rebuild my project. It appears that the original class is still present in some directory that Ant uses in its classpath, and this out-of-date class is taking precedence over the new version. The new class is present in the classpath which I assign in build.xml. I can find no instance of the previous version of the class which Ant is running instead of the current version.

One thing of interest is that when I run the Ant task in Eclipse I get a message telling me "Waiting for virtual machine to exit" -- I'm not sure what this means but perhaps it has some significance?

My task is defined in the Ant target like so:

If anyone can shed any light on this for me I'd certainly appreciate it. Thanks in advance!


--James
[ August 11, 2005: Message edited by: James Adams ]
 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem turned out to be a bonehead mistake on my part. I have both a main() and an execute() method in my class. The execute() is just a copy of the code in main(), and when I modified the class I modified the code in main() without making the same changes to execute(), which is the actual method that Ant is running. Now that I have made the changes in execute() all is well again in the universe.


--James
reply
    Bookmark Topic Watch Topic
  • New Topic