自动 Ant 构建 - 有任何开源项目可以发现文件系统中的更改以启动构建吗?

发布于 2025-01-04 11:48:26 字数 257 浏览 2 评论 0原文

有没有人发现任何方法可以根据文件系统的更改自动触发 ant 构建过程?

我基本上希望我的 ant 构建系统能够像 IDE(编译 java 类)一样开始构建,但通过某种命令行服务进行构建。

如果没有,总是可以使用 Java 进行编码并将 Ant API 集成到其中。

我熟悉 Jenkins 等持续集成系统,但是我需要触发构建而不是签入。另外,我希望它独立于 IDE,因为它可以在保存后工作。

我正在寻找没有源代码控制要求的独立构建服务。

Has anybody discovered any means to fire an ant build process automatically based on file system changes?

I basically want my ant build system to begin building similar to an IDE (compile java classes) but from some sort of command line service.

If not, there's always coding one up with Java and integrating the Ant API into it.

I am familiar with continuous integration systems like Jenkins and the like, however I need the build to be fired not check-in. Also I would like it to be independent of the IDE, as that could work on post-save.

I'm looking for an independent build service without source control requirements.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浴红衣 2025-01-11 11:48:26

由于您使用的是 ant,我假设基于 java 的目录轮询程序将在这里提供帮助。 api编写程序

您可以使用IO通知 从页面

何时使用和不使用此 API

Watch Service API 专为需要
有关文件更改事件的通知。它非常适合任何
应用程序,例如编辑器或 IDE,可能有许多打开的
文件并需要确保文件与
文件系统。它也非常适合应用程序服务器
监视目录,可能等待 .jsp 或 .jar 文件删除,
以便部署它们。

此 API 不是为硬盘驱动器索引而设计的。大多数文件系统
实现具有对文件更改通知的本机支持。这
Watch Service API 在可用的情况下利用此支持。
但是,当文件系统不支持这种机制时,Watch
服务将轮询文件系统,等待事件。

编辑

在我写下这个问题及其答案之后似乎更有用: 是否有用于 Java 的免费或开源的复杂文件系统监视器?

Since you are using ant I assume a java based directory polling program will help here. You can write a program using IO notification api

Notes from the page

When to Use and Not Use This API

The Watch Service API is designed for applications that need to be
notified about file change events. It is well suited for any
application, like an editor or IDE, that potentially has many open
files and needs to ensure that the files are synchronized with the
file system. It is also well suited for an application server that
watches a directory, perhaps waiting for .jsp or .jar files to drop,
in order to deploy them.

This API is not designed for indexing a hard drive. Most file system
implementations have native support for file change notification. The
Watch Service API takes advantage of this support where available.
However, when a file system does not support this mechanism, the Watch
Service will poll the file system, waiting for events.

Edit

After I wrote that this question and its answer seems to be more useful here: Is there a sophisticated file system monitor for Java which is freeware or open source?

冷了相思 2025-01-11 11:48:26

广泛实践的方式是“持续构建”/“持续集成”的方式。示例工作流程:

  1. 将代码签入源代码控制存储库
  2. 继续集成服务器从存储库中获取更改并启动构建过程
  3. 构建过程会导致成功或失败,从而为您提供快速反馈

很多持续集成服务器( Bamboo、Jenkins、Go)原生支持 Ant。

您还可以在 IDE 中设置保存后挂钩。大多数现代都支持它:IntelliJ、NetBeans、Eclipse。

在谷歌中查找“持续集成”。

The widely practiced way is a way of "continuous build" / "continuous integration". A sample work-flow:

  1. You check in your code into a source control repository
  2. Continues Integration server picks up changes from the repository and starts a build process
  3. The build process results in either success or failure giving you a fast feedback

Lot's of continuous integration servers (Bamboo, Jenkins, Go) support Ant natively.

You can also set up post-save hooks in your IDE. Most modern ones support it: IntelliJ, NetBeans, Eclipse.

Look up "continuous integration" in google.

入画浅相思 2025-01-11 11:48:26

一位朋友向我指出了这一点:

https:// serverfault.com/questions/179706/how-can-i-trigger-a-script-to-run-after-the-rsyncdaemon-received-file-changes-to

一个小脚本,用于监视更改并执行独立任务。

如果有人有更好的直接使用 ANT 脚本的方法,请告诉我。

A friend pointed me to this:

https://serverfault.com/questions/179706/how-can-i-trigger-a-script-to-run-after-the-rsyncdaemon-received-file-changes-to

A little script to monitor for changes and execute and independent task.

If anyone has a better method that works with ANT scripts directly, let me know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文