Java 这是什么 ANT 构建?

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

what is this ANT build?

javaeclipseant

提问by vas

I am new to jav/Eclipse.

我是 jav/Eclipse 的新手。

I installed eclipse and working on a JAVA 1.4 file using it as an IDE. I made my code changes and saved it and wanted to Run (cntr F11) or debub (F11) every time i am getting

我安装了 eclipse 并使用它作为 IDE 处理 JAVA 1.4 文件。我对代码进行了更改并保存了它,并希望每次运行(cntr F11)或 debub(F11)

 select what to run 
           Ant Build 
           Ant Build..

what is this Ant Build ? How to rectify /connect/ Ant Build?

这个 Ant Build 是什么?如何纠正/connect/ Ant Build?

Ant Build has turned a sort of raod block for me vis a vis running the file. How to Run my file with out getting Ant road blocks?

Ant Build 已经为我打开了一种运行文件的可视化块。如何在没有获得 Ant 路障的情况下运行我的文件?

回答by erenon

You can use Ant to build your project, generate docs from inline javadocs, check for coding standard violation, run tests and such. You can use it with a version control system and/or continous integration system together.

您可以使用 Ant 构建您的项目、从内联 javadoc 生成文档、检查是否违反编码标准、运行测试等。您可以将它与版本控制系统和/或持续集成系统一起使用。

Apache Ant
Cruise Control ci system

Apache Ant
Cruise Control ci 系统

回答by whatnick

The Java file needs a main method for eclipse to offer you the option to run as a Java application. Otherwise it gives other options such as run on server or run as Ant build and so on.

Java 文件需要一个用于 eclipse 的 main 方法,以便为您提供作为 Java 应用程序运行的选项。否则,它会提供其他选项,例如在服务器上运行或作为 Ant 构建运行等。

回答by Tracy Probst

You don't need an ANT build to test run a simple Java application. Here's what I do:

您不需要 ANT 构建来测试运行一个简单的 Java 应用程序。这是我所做的:

With the java source file open, click on the down-arrow next to the green run button on the tool bar. Then choose the run button in the drop-down like this:

打开 java 源文件后,单击工具栏上绿色运行按钮旁边的向下箭头。然后在下拉菜单中选择运行按钮,如下所示:

alt text http://tracyprobst.com/SOImages/EclipseRun1.JPG

替代文字 http://tracyprobst.com/SOImages/EclipseRun1.JPG

There is probably a menu option or function key to get there, but I never learned it.

可能有一个菜单选项或功能键可以到达那里,但我从来没有学过。

On the resulting screen, click the button on the top left corner to launch a new configuration. Here you can supply things like arguments or set a special classpath that's different than your project configuration.

在结果屏幕上,单击左上角的按钮以启动新配置。在这里,您可以提供诸如参数之类的内容或设置与您的项目配置不同的特殊类路径。

Then click the RUN button on the bottom of the dialog and it will run your code. Once you have the run configuration defined, you don't need to define it again for that particular class. The Debug button and Run button are the toolbar share the same run configurations.

然后单击对话框底部的 RUN 按钮,它将运行您的代码。一旦定义了运行配置,就不需要为该特定类再次定义它。调试按钮和运行按钮是共享相同运行配置的工具栏。

回答by user1577636

I had the exact same problem, where when I clicked "Run" I would get a menu with options of "Ant Build" or "Ant Build..." -- even though I had a main method.

我遇到了完全相同的问题,当我点击“运行”时,我会得到一个带有“Ant Build”或“Ant Build...”选项的菜单——即使我有一个主要方法。

I finally got my program to run as normal when I copied and pasted my code into a new file in a new project folder. I deleted the old file altogether, along with its source folder.

当我将代码复制并粘贴到新项目文件夹中的新文件中时,我终于让我的程序正常运行。我完全删除了旧文件及其源文件夹。

When I created the new class, I selected the option "Use project folder as root for the sources and class files" instead of creating separate folders.

创建新类时,我选择了“使用项目文件夹作为源文件和类文件的根目录”选项,而不是创建单独的文件夹。

Then, when I clicked "Run", I got some peculiar output the first time that I didn't understand. The second time, however, I got all my programs running as they used to.

然后,当我点击“运行”时,我第一次得到了一些我不明白的奇怪输出。然而,第二次,我让我所有的程序都像以前一样运行。

I'm not exactly sure what these actions did to solve the problem, as I, too, am a novice programmer. But I'm getting my information from http://www.daniweb.com/software-development/java/threads/199459/simple-java-applet-wont-run-on-eclipse#.

我不确定这些操作是如何解决问题的,因为我也是一名新手程序员。但我从http://www.daniweb.com/software-development/java/threads/199459/simple-java-applet-wont-run-on-eclipse#获取我的信息。

Hope this helps.

希望这可以帮助。

回答by Thanga

1.Compiling the code 2.Packaging the binaries 3.Deploying the binaries to the test server 4.Testing the changes 5.Copying the code from one location to another

1. 编译代码 2. 打包二进制文件 3. 将二进制文件部署到测试服务器 4. 测试更改 5. 将代码从一个位置复制到另一个位置

To automate and simplify the above tasks, Apache Ant is useful. It is an Operating System build and deployment tool that can be executed from the command line.

为了自动化和简化上述任务,Apache Ant 很有用。它是一个可以从命令行执行的操作系统构建和部署工具。

回答by Vladut Octavian

I got this problem too. For example it happend to me because I wrote the code in NetBeans then I tried to run it with Eclipse. First pop-up was:

我也遇到了这个问题。例如,它发生在我身上,因为我在 NetBeans 中编写了代码,然后我尝试使用 Eclipse 运行它。第一个弹窗是:

Ant Build

蚂蚁构建

then it showed up this Error:

然后它出现了这个错误:

Error

错误

The easiest solution for me was to copy and paste my class into a new one created in Eclipse.No other Errors showed up and the code ran at first attempt.

对我来说,最简单的解决方案是将我的课程复制并粘贴到在 Eclipse 中创建的新课程中。没有其他错误出现,代码在第一次尝试时运行。

回答by Damian

I had the same issue I resolved by:

我遇到了同样的问题,我通过以下方式解决:

  1. creating a new Java project in the workspace you are using.
  2. create a new class within your project.
  3. copy your code into your srcfolder and run.
  1. 在您正在使用的工作区中创建一个新的 Java 项目。
  2. 在您的项目中创建一个新类。
  3. 将您的代码复制到您的src文件夹中并运行。

It will work.

它会起作用。

回答by user9135196

(Go to Project Menu and Remove check mark from Build Automatically) Check this option first, it gave me whole a lot of Headache REMOVE Check mark!

(转到项目菜单并从自动生成中删除复选标记)首先选中此选项,它让我很头疼删除复选标记!

Click here for image if you can not find it

如果找不到,请单击此处查看图像