Dieter Profos
Dieter Profos

Reputation: 57

Ant in Eclipse Luna seems not to work... why?

I'm using Eclipse Luna for the first time and trying to run an Ant script (for javacc). However, there are some strange things happening: * The "generate" part of the script is run twice when I start the script, * The script contains "eclipse.refreshLocal ..." but I get an error message "Problem: failed to create task or type eclipse.refreshLocal". The script is the following:

<project name="javacc">
  <target name="generate">
    <javacc target="src/grammar.jj"
      outputdirectory="src/of/project"
      javacchome="c:/Programme/JavaCC/bin/lib"
    />
  </target>
  <target name="refresh" depends="generate">
    <eclipse.refreshLocal
      resource="D:/src/of/project" depth="infinite"/>
  </target>
</project>

I have tried to find out if there is something wrong about the Ant integration but apparently I didn't see the reason. At least, the "plugins" folder of Eclipse contains "org.apache.ant...", and I did cross "Always run new Ant configurations in the same JRE...". Right clicking on the script shows the context menu containing "Run As..." and then "Ant Script", and if I hit that item, it starts running... but with the above errors. Does anyone see what's going wrong?

Upvotes: 0

Views: 1918

Answers (2)

Tiago Medici
Tiago Medici

Reputation: 2194

In case of using eclipse.refreshLocal

click on Run -> External Tools -> External Tools Configuration

then choose **Run in the same JRE as the workspace**

enter image description here

Upvotes: 0

greg-449
greg-449

Reputation: 111216

If you want to use eclipse.refreshLocal you must run Ant in the workspace JRE.

To do this open 'Run > External Tools > External Tools Configuration'. Find your Ant script in the 'Ant Build' section and select 'Run in the same JRE as the workspace' on the JRE tab.

Alternatively you can get to this dialog by right clicking on the build.xml file and selecting 'Run As > External Tools Configuration'

Upvotes: 2

Related Questions