Ant Version 1.6.x vs. 1.7.x and Eclipse 3.3
July 19, 2007 by Jim · 9 Comments
I recently upgraded to Eclipse 3.3 and CFEclipe 1.3.1.5 and have had no problems – until today.
I’m working on some example Ant scripts for an upcoming presentation – and kept getting an error when trying to do very simple builds using an INPUT task:
BUILD FAILED
E:\workspace\helloworld\build.xml:30: jave.lang.NullPointerException
This was on a laptop on which I had just installed a fresh copy of Eclipse, Java and CFEclipse. What was frustrating was the same script ran fine on my desktop.
I did some digging and discovered my desktop Ant was still pointing to my old Eclipse 3.2 setup which used Ant 1.6.5!!
Ah-ha!
So I copied the old org.apache.ant_1.6.5 directory from my Eclipse 3.2 directory on my desktop to the laptop (I dropped it into the Eclipse 3.3 plugins directory) and changed the Ant classpaths to use the older version – my build file worked again!
To check / change your classpaths:
- Window > Preferences
- Expand Ant
- Click Runtime
- Select the Classpath tab
- Expand the “Ant Home Entries (Default)
You will now see a list of .jar files.
The path should include – org.apache.ant.1.7.0.vXXXXXXXXX – you can simple select all of these – and click Remove. Then click Add External JARS… and select all the .jar files in the older 1.6.5 dir – C:\eclipse-3.3\plugins\org.apache.ant_1.6.5\lib.
Don’t worry – when you click “Remove” you aren’t deleting anything so you can always go back to the newer JAR versions…
I’m going to dig around and see if this is an Ant or Eclipse problem. The same scripts work fine using the 1.7.x version of command line ANT.
In the meantime this ‘fix’ will allow me to continue working on my presentation and have working examples!
Update:
Quick update – I found a post on Project Kody which has a fix. Eclipse Europa (3.3.0) – Discovered odd behaviour with Ant input task.
Through experimentation I discovered that by setting Ant to run in the same JRE as the workspace the input task succeeded!
- Click Run
- Click External Tools
- Click Open External Tools Dialog
- Click the JRE tab
- Select “Run in the same JRE as the workspace”
Possibly Related:

The Ant Version 1.6.x vs. 1.7.x and Eclipse 3.3 by Jim, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.



Did you find the problem with ant 1.7, about the input task?
It looks like related to the use of the defaultValue in the input task.
No – I haven’t done any more with this – haven’t had the time, and I’m using an alternate task for input so I have been able to get by without…
Here is what I found out:
It’s an Eclipse bug, not an Ant issue.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=195986
Fixed in the 3.4 stream.
Planning to fix in the 3.3.1 stream.
Thanks
Just saw your post on the Ant list :)
I figured it was an Eclipse issue as the command line in 1.7 works fine with the same build file…
I have a working Eclipse project that builds correctly. I also have
an ant script that works from the command-line.
I want to add the ant script as one step in my build process.
However, I am attempting to do this with an Eclipse “builder” and the
script will not run correctly.
Can anyone point me to information on how to include an ANT script as
part of my build process in Eclipse.
@plastik – Have you checked out my Ant resources on my wiki: http://www.thecrumb.com/wiki/Ant
Does your Ant script require any external tasks?
mad props Jim. this came in really handy today when trying to set up a machine. thanks a lot.
–Marc
thank you very good
“Run in the same JRE as the workspace” did the trick for me. It would have been impossible to figure out if I did not find your post. Thank you so much!