简体   繁体   English

Eclipse Luna中的Ant似乎不起作用……为什么?

[英]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). 我是第一次使用Eclipse Luna,并尝试运行Ant脚本(对于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". 但是,发生了一些奇怪的事情:*启动脚本时,脚本的“生成”部分运行了两次,*脚本包含“ eclipse.refreshLocal ...”,但出现错误消息“问题:无法创建任务或键入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. 我试图找出Ant集成是否存在问题,但显然我没有找到原因。 At least, the "plugins" folder of Eclipse contains "org.apache.ant...", and I did cross "Always run new Ant configurations in the same JRE...". 至少,Eclipse的“ plugins”文件夹包含“ org.apache.ant ...”,而我确实做了“始终在同一JRE中运行新的Ant配置...”。 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? 有人看到出什么问题了吗?

If you want to use eclipse.refreshLocal you must run Ant in the workspace JRE. 如果要使用eclipse.refreshLocal ,则必须在工作区JRE中运行Ant。

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. 在“ Ant Build”部分中找到您的Ant脚本,然后在“ JRE”选项卡上选择“在与工作空间相同的JRE中运行”。

Alternatively you can get to this dialog by right clicking on the build.xml file and selecting 'Run As > External Tools Configuration' 或者,您可以通过右键单击build.xml文件并选择“运行方式>外部工具配置”来进入此对话框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM