javac 的可解析输出? XML?

发布于 2024-12-11 11:34:56 字数 334 浏览 5 评论 0原文

我们目前使用 ant 构建 Java 应用程序。 我的目标是找到一种方法来识别哪个文件导致构建失败。

我可以做什么 -

  • 解析其中包含“.java”的所有内容。
  • 过滤掉所有包含“.java:number: warning”的内容
  • 解析该行的文件、行和原因。

这并不难……但似乎有点不稳健。 (我现在想不出一个更好的词。也许是“坏”)

太糟糕了,无论如何都不能以 XML 格式输出它?或者也许有?

编辑:这个项目的假设之一是我们不想在每次更改的基础上进行构建,但现在我已经与詹金斯合作了一些,我认为这实际上是可能的。

We currently build our java app using ant.
My goal is to find a way to identify which file caused the build to fail.

What I could do-

  • Parse for everything that has ".java" in it.
  • Filter out everything that has ".java:number: warning"
  • Parse that line for the file, line, and reason.

This isn't that hard... but it seems a bit non-robust. (A better word currently escapes me. maybe "bad")

Too bad there isn't anyway to have it output in XML? Or maybe there is?

EDIT: One of the assumptions of this project were that we wouldn't want to do builds on every change, but now that I've worked with jenkins a bit, I am thinking that this might actually be possible.

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

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

发布评论

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

评论(2

可遇━不可求 2024-12-18 11:34:56

我认为不存在。这可能是 Eclipse 有自己的编译器的原因之一。

您可以通过拥有自己的 ant 任务来限制问题(这样您就可以更好地控制输出格式,并且不必解析整个 ant 输出)。

如果您正在设计一个构建系统,从源代码管理中提取源代码(您标记了 jenkins),一个更简单的选择是列出上次成功构建和损坏的构建之间的更改。

你想实现什么目标?

I don't think there is. Probably one of the reasons Eclipse has its own compiler.

You can limit the problem by having your own ant task (so you have more control about output formatting and won't have to parse the whole ant output).

If you are designing a build system pulling the sources out of a source control (you tagged jenkins), an easier option is to list the changes between the last successful build and the broken ones.

What are you trying to accomplish?

我也只是我 2024-12-18 11:34:56

将输出作为 XML 的方法是:

ant -listener org.apache.tools.ant.XmlLogger

输出将保存在构建目录中的 log.xml 中。不幸的是,结构不能很好地支持您的需求。

Way to have output as XML is:

ant -listener org.apache.tools.ant.XmlLogger

Output will be saved log.xml in build directory. Unfortunately structure does not support your needs too well.

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