想要一个eclipse java项目自动运行ant构建文件 [英] Want an eclipse java project to run ant build files automatically

查看:39
本文介绍了想要一个eclipse java项目自动运行ant构建文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Eclipse Java 项目,而不是插件项目.该项目有一些外部依赖项,我在两个单独的 ant 文件中处理这些依赖项.一切正常,但我想强制 Eclipse 每次构建我的项目时都运行 ant 文件.

I have an Eclipse Java project, not a plugin project. And the project has some external dependencies that I handle in two separate ant files. Everything works fine, but I want to force Eclipse to run the ant files everytime it builds my project.

我该怎么做?

如果这是一个插件项目,我会在 customBuildCallbacks.xml 中处理它并将其包含在我的 build.properties 中,但当它只是一个 java 项目时似乎不起作用

If this had been a plugin project I would have handled it in a customBuildCallbacks.xml and included it in my build.properties, but doesnt seem to work when its just a java project

推荐答案

步骤 1:将构建文件添加到您的 ant 视图

Step 1: Add the build file to your ant view

单击添加按钮并从项目中选择 build.xml 文件.您还可以将 build.xml 文件拖到 ant 视图上(要将 ant 视图添加到您的透视图中,请转到 Window > Show View > Other...)

Click the add button and select the build.xml file from the project. You can also drag the build.xml file onto the ant view (To add the ant view to your perpective, go to Window > Show View > Other…)

第 2 步:作为 Ant Build 运行

Step 2: Run as Ant Build

在您的 ant 视图中,右键单击新添加的构建文件并选择 Run As > Ant Build... 在对话框窗口中,在 Targets 选项卡中选择Hide internal targets not selected for execution"选项.如果您愿意,您可以在窗口顶部的框中重命名构建器(我通常会删除尾随的build.xml".单击应用并关闭".

In your ant view, right click the newly added build file and select Run As > Ant Build… In the dialog window, select the ‘Hide internal targets not selected for execution’ option in the Targets tab. You can rename the builder in the box at the top of the window if you wish (I usually remove the trailing ‘build.xml’. Click Apply and Close.

第 3 步:设置自动构建

Step 3: Setup automatic build

右键单击项目,选择属性,然后选择构建器.单击导入.在关闭屏幕之前,突出显示导入的构建并选择编辑.转到 Targets 选项卡,为After a clean"选择 clean,为Auto build"选择 deploy.local.应用更改并关闭.

Right click on the project, select Properties, then Builders. Click Import. Before closing the screen, highlight the imported build and select edit. Go to the Targets tab select clean for ‘After a clean’ and deploy.local for ‘Auto build’. Apply the changes and close.

第 4 步:启用自动构建

Step 4: Enable Auto Build

转到项目 > 自动构建

Go to Project > Build Automatically

来源:http://www.simonwhatley.co.uk/using-ant-with-eclipse

这篇关于想要一个eclipse java项目自动运行ant构建文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆