Java 项目中的 build.xml

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1551107/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:01:18  来源:igfitidea点击:

build.xml in Java project

javaeclipsenetbeansantbuild

提问by Granit

What is the file build.xml?

文件是什么build.xml

I was wondering if it is a possibility to import this project in Eclipse or Netbeans using this build.xml. I tried to import the project but I get some errors since one part is created using J2ME and the other J2SE and I guess this file should be the configuration.

我想知道是否有可能使用这个在 Eclipse 或 Netbeans 中导入这个项目build.xml。我尝试导入该项目,但出现了一些错误,因为其中一部分是使用 J2ME 创建的,而另一部分是使用 J2SE 创建的,我猜这个文件应该是配置文件。

采纳答案by coobird

build.xmlusually is an antbuild script.

build.xml通常是一个蚂蚁构建脚本。

It contains information necessary to build the project to produce the desired output, be it Javadocs, a compiled project, or a JAR file.

它包含构建项目以产生所需输出所需的信息,无论是 Javadoc、编译项目还是 JAR 文件。

I believe Eclipse has ant built-in, so it should be possible to execute the build.xmlby choosing "Run As..." and "Ant Build".

我相信 Eclipse 内置了 ant,因此应该可以build.xml通过选择“Run As...”和“Ant Build”来执行。

The build.xmlfile, if it is an ant script, is not used to import the project into an IDE like Eclipse or Netbeans. A build script is used to build the project (or produce some desired output) rather than an mechanism for importing the project into an IDE.

build.xml文件(如果是 ant 脚本)不用于将项目导入到 Eclipse 或 Netbeans 等 IDE 中。构建脚本用于构建项目(或生成一些所需的输出),而不是用于将项目导入 IDE 的机制。

回答by dj_segfault

Eclipse can be told to build using an Ant script, but you can also use Ant itself.

可以告诉 Eclipse 使用 Ant 脚本进行构建,但您也可以使用 Ant 本身

回答by peter.murray.rust

As mentioned by @coobird this is an ant build file. Although IDEs such as Eclipse and Netbeans have ant support built-in, it is also possible to run ant from the command-line and this may be the simplest way to get started if the project has been well created.

正如@coobird 所提到的,这是一个 ant 构建文件。尽管 Eclipse 和 Netbeans 等 IDE 内置了 ant 支持,但也可以从命令行运行 ant,如果项目已经创建好,这可能是最简单的入门方法。

See http://ant.apache.org/for docs.

有关 文档,请参阅http://ant.apache.org/

If you want to try this approach, install ant, cdto the directory with build.xmland issue

如果您想尝试这种方法,请将 ant 安装cd到目录build.xml并发出

ant

回答by peter.murray.rust

build.xml file is an Ant(Apache) script. you can find more information on Ant & build.xml here

build.xml 文件是一个 Ant(Apache) 脚本。您可以在此处找到有关 Ant 和 build.xml 的更多信息

回答by sandip divekar

In java project build.xml file is used write the ant script. And from that ant script you can generate war file and can deploy on Tomcat server

在java项目build.xml文件中用于编写ant脚本。从那个蚂蚁脚本你可以生成war文件并可以部署在Tomcat服务器上