Java 变量引用不存在的资源 Build.xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19160620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Variable references non-existent resource Build.xml
提问by BladeHal
I am using Eclipse Kepler and I am trying to execute my build script.
我正在使用 Eclipse Kepler 并且我正在尝试执行我的构建脚本。
When I run a task, I get an Ant error that says
当我运行一个任务时,我收到一个 Ant 错误,上面写着
Variable references non-existent resource : ${workspace_loc:/MyProject_JAVA/dev-new/build.xml}.
变量引用不存在的资源:${workspace_loc:/MyProject_JAVA/dev-new/build.xml}。
The problem is this path is wrong. It should be :
问题是这条路是错误的。它应该是 :
/MyProject_JAVA/dev/dev-new/build.xml.
/MyProject_JAVA/dev/dev-new/build.xml。
I can go into External Tools and change the config for this one build, but if I try to run the task again, I get the same error.
我可以进入外部工具并更改此构建的配置,但是如果我尝试再次运行该任务,则会出现相同的错误。
How do I change where Ant thinks the build file is?
如何更改 Ant 认为构建文件的位置?
回答by Jamie Bisotti
I think your closing curly brace is misplaced and I'm not sure the colon is necessary. Try:
${workspace_loc}/MyProject_JAVA/dev-new/build.xml
我认为您的大括号放错了位置,我不确定冒号是否必要。尝试:
${workspace_loc}/MyProject_JAVA/dev-new/build.xml
EDIT: I'm assuming you are using this in your Ant Build external configuration's "Main" tab, in the "Base Directory" field.
编辑:我假设您在 Ant Build 外部配置的“Main”选项卡的“Base Directory”字段中使用它。
EDIT 2: Actually, as I look at your description closer, it appears the MyProject_JAVA folder exists outside of the workspace. Is that correct? If so, try using ${project_loc} instead.
编辑 2:实际上,当我仔细查看您的描述时,似乎 MyProject_JAVA 文件夹存在于工作区之外。那是对的吗?如果是这样,请尝试使用 ${project_loc} 代替。
回答by billni
I met same problem , fortunately I solved it. Go into preferences of Eclipse, and edit Ant - Runtime - Classpath. You will find reason, and delete the error configured entry.
我遇到了同样的问题,幸运的是我解决了它。进入 Eclipse 的首选项,然后编辑 Ant - Runtime - Classpath。你会找到原因,并删除错误配置的条目。
回答by Kyle Stoflet
To add on to billni'sanswer, you may have an incorrectly defined Ant classpath.
要添加到billni 的答案中,您可能有一个错误定义的 Ant 类路径。
Find the bad path within Window > Preferences > Ant > Runtime > Entries
在Window > Preferences > Ant > Runtime > Entries 中找到错误路径
I have 3 entry types:
我有 3 种条目类型:
Ant Home Entries
Global Entries
Contributed Entries
蚂蚁首页条目
全局条目
贡献的条目
For my situation, the bad path was in > Global Entries
对于我的情况,糟糕的路径在 > Global Entries
To fix this, remove the bad path by selecting > Remove
要解决此问题,请通过选择 >删除来删除错误路径
Add the new and correct path by either using > Add JARs...or > Add External JARs...
使用 > Add JARs...或 > Add External JARs...添加新的正确路径
Add JARs...> allows you to add archives from your package explorer to your build path.
Add External JARs...> allows you to add archives from your local file system to your build path.
添加 JARs...> 允许您将包资源管理器中的档案添加到构建路径。
添加外部 JAR...> 允许您将本地文件系统中的存档添加到构建路径。
Assuming your path is correct, and that there are no other errors, your build should now work!
假设您的路径是正确的,并且没有其他错误,您的构建现在应该可以工作了!