Xcode 错误:“构建文件:build.xml 不存在!构建失败”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2614378/
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
Xcode Error: "Buildfile: build.xml does not exist! Build failed"
提问by nicky
I am trying to use Xcode 3.2 for java tool development. My project has no problem building and shows it built the file build.xml fine and also shows up in file folder fine. When I try to run the .java file, I get the error: "Buildfile: build.xml does not exist! Build failed". Running "ant -find build.xml" in Terminal produces "not found". I believe the problem is that I need to point to my own build.xml location, but I have no idea how to change which directory it looks for this file. Any help is greatly appreciated. -nick
我正在尝试使用 Xcode 3.2 进行 java 工具开发。我的项目构建没有问题,并显示它构建了文件 build.xml 并且也很好地显示在文件夹中。当我尝试运行 .java 文件时,出现错误:“Buildfile:build.xml 不存在!构建失败”。在终端中运行“ant -find build.xml”会产生“not found”。我相信问题是我需要指向我自己的 build.xml 位置,但我不知道如何更改它查找此文件的目录。任何帮助是极大的赞赏。-缺口
Mac OS 10.6, Xcode 3.2.1 - method to create app: Organizer>New from template>Java Tool
Mac OS 10.6, Xcode 3.2.1 - 创建应用程序的方法:管理器>从模板新建>Java工具
回答by Stephen C
The Ant manualsays this:
该Ant手册这样说:
When no arguments are specified, Ant looks for a
build.xml
file in the current directory and, if found, uses that file as the build file and runs the target specified in the default attribute of the<project>
tag. To make Ant use a build file other thanbuild.xml
, use the command-line option-buildfile file
, wherefile
is the name of the build file you want to use.
如果未指定任何参数,Ant 会
build.xml
在当前目录中查找文件,如果找到,则使用该文件作为构建文件并运行在<project>
标签的默认属性中指定的目标。要使 Ant 使用除 之外的构建文件build.xml
,请使用命令行选项-buildfile file
,其中file
是您要使用的构建文件的名称。
So the answer your question is that you either need to change directory to the directory containing the build.xml
file, or you need to add a -buildfile file
option, where file
is the pathnamefor the build file.
因此,您的问题的答案是,您要么需要将目录更改为包含该build.xml
文件的目录,要么需要添加一个-buildfile file
选项,其中file
是构建文件的路径名。
回答by nicky
I got it to build fine now. Turns out it was building fine, I was just running the .java file and not the entire built application. but now I know how to build via Terminal.
我现在让它建造得很好。结果证明它构建得很好,我只是在运行 .java 文件而不是整个构建的应用程序。但现在我知道如何通过终端构建。