Eclipse PDE 无头构建失败:无法创建任务或类型 eclipse.generateFeature

Eclipse PDE headless build fails with: failed to create task or type eclipse.generateFeature

我想用 PDE headless build 构建一个 Eclipse RCP 应用程序。当我 运行 构建的 Ant 脚本失败并显示以下错误消息时:

failed to create task or type eclipse.generateFeature 
Cause: The name is undefined.

我在讨论中找到了解决方案here: 运行 在与工作区相同的 JRE 中构建的 Ant 脚本很重要,否则无法找到 PDE Ant 任务:

右键单击 Ant 脚本 (build.xml) > 运行 As > Ant Build ... > 向导的 JRE 选项卡 > 切换到选项:'Run in the same JRE as the workspace'