I'm running Ant 1.6 through Eclipse 3.4 Ganymede on Win XP. I'm running into OutOfMemroyErrors when compiling and running my JUnit tests through Ant. I read that Eclipse does not pay attention to the "ANT_OPTS" argument. Where can I set the memory size for Ant within Eclipse?
Are your running Ant in a separate process or within Eclipse's process? If the former, then are you running Ant as a task or as a builder? Either way, there should be a JRE tab for the Ant run configuration properties - you can add the heap settings there. If you are running within the Eclipse process, then you can set heap size for Eclipse in eclipse.ini within the Eclipse home directory.
If this does not help, please state exactly how you are running Ant within Eclipse.
I think that running the Ant build that way runs it within Eclipse (that is, in the same JVM as Eclipse). So you would set the JVM options for Eclipse in eclipse.ini.
If you want to run Ant as a separate process, try this. Go to Project | Properties, then Builders and click New. Select Ant Builder, then in the Edit Configuration place your build.xml file in the Buildfile field on the Main tab, and then on the JRE tab select Separate JRE and add the JVM options in the VM Arguments field. Then back on the project Properties dialog,. unselect the other builder so that only the Ant builder is selected. Now any time you build the project it will use Ant in a separate process.
Joined: Jul 02, 2008
As as follow up to this, I increased my heap size but when I started Eclipse I got this screen
You are setting the heap to 1GB and the permgen to 1/2GB. You are might be running out of memory (though when I set my memory too high I get a "Could not create Java virtual machine" dialog). Eclipse generates a log file for such an error, and it will have more details (I would tell you where it is, but I can't find the file).