Friday, October 22, 2010

Ant Javac stops Compiling when fork=true

This one was a beast and unfortunately I still don't have any definitive answers as to why this happens. I had an Ant javac task with the following attribute:


fork="true"

When I would run Ant, it would say that it was starting to compile, and then it'd just stop. My class files would never be generated, but it would not have an error explaining what went wrong. (For the record there were more attributes, blogger doesn't accept the javac xml tag though....trust me, all the other attributes were right as rain.)

I tried playing around with setting an executable attribute, ensuring it was pointing to a javac executable (when you set fork = true, you're telling it to compile externally). This didn't work either. I turned on verbose logging by going into Eclipse->External Tool Configurations and setting -verbose as an argument in the arguments section of the configurations. This spit out a bunch more detail, but still nothing helpful.

The javac process would start without error, it'd list all the .java files that it found that needed compiling, and then stop. No error, no warning, just hang there doing nothing.

After much playing around, I found out that if I removed the fork attribute everything would work fine.

Unfortunately that's all I've got for you. I've wasted 8 hours on this thing and still am not closer to why this happens. If anyone happens to know why this is happening please let me know. I've tried altering JAVA_HOME's, default JDK's being used, etc. I've tried increasing the amount of memory......

I give up. If you experience this problem, where javac hangs without error and without completing, try making fork="false".

No comments:

Post a Comment