Ant build scripts totally hangs, with no messages

2020-04-02 07:28发布

问题:

I have build.xml for my project, but even this small piece of code

  <target name="init">
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>

It doesn't run

Console is empty but process is active. I still can terminate it over STOP button

In same time I cannot debug it as well, same stuff active process no output in console and I can wait forever! Any ideas?

  • JDK 1.6.0_14
  • Eclipse 3.5.1

Edited: Thank to Peter's Loron question I checked workspace log file MyWorkspace/.metadata/.log There I saw error message I googled it and found that this happening because location of my Eclipse changed, but path to ANT jars remains old. TO Fix that you have to go Preferences->Ant->Runtime and click Restore Default it will pickup new jar location and warn you about absence of tools.jar, copy it from somewhere and drop it in same folder where other ant jars.

回答1:

Edited: Thank to Peter's Loron question I checked workspace log file MyWorkspace/.metadata/.log There I saw error message I googled it and found that this happening because location of my Eclipse changed, but path to ANT jars remains old.

TO Fix that you have to go Preferences->Ant->Runtime and click Restore Default it will pickup new jar location and warn you about absence of tools.jar, copy it from somewhere and drop it in same folder where other ant jars.



回答2:

Here is yet another possible fix:

  • Go to Preferences->Ant->Runtime
  • Classpath tab
  • Click Restore Defaults button.

That happened to fix the issue for me.



回答3:

I'm using IBM RAD7 (which is based on Eclipse) and I was having exactly the same problem. After much fiddling I went to "External Tools" | JRE Tab | select "Run in same JRE", mine was set yo use the Webpshere JRE. Took a day to fix it! Nigel



回答4:

Another quick thing to look for... Check your VM memory specs... I was messing around with low memory settings and it caused the same issues as above...



回答5:

If you are running the script using "External Tools Configuration" you should also check the following:

Open "External Tools Configuration" and select the launcher that starts the Ant script. In the tab "Common" make sure that "Allocate console (necessary for input)" is checked!

In my case it was not checked and was the reason why no console output was visible.