如何在javadoc编译期间抑制警告(代码库范围)? [英] How can I suppress warnings (codebase-wide) during javadoc compilation?

查看:180
本文介绍了如何在javadoc编译期间抑制警告(代码库范围)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了遗留的Java代码库,它在编译时会发出数千条警告。我希望能够真正解决所有这些警告的来源,但不幸的是,此时我的公司不是一个选择(其他诸如制作产生收入的新产品被认为是负责人的优先考虑;看上去那样) 。

I'm stuck with a legacy Java codebase that has THOUSANDS of warnings when you compile it. I would love to actually fix the source of all these warnings, but unfortunately that's not an option at this time at my company (other things like "making new products that generate revenue" are considered higher priority by the people in charge; fancy that).

现在,我可以接受所有这些警告,如果不是因为它们很难找到我们输出中的实际错误连续构建服务器。构建服务器只使用一个蚂蚁调用,没什么特别的,但到目前为止,我还没有找到任何可以修改此调用以防止警告输出的地方。

Now, I could just live with all of these warnings, if it wasn't for the fact that they make it difficult to find actual errors in the output from our continuous build server. The build server just uses an ant call, nothing fancy, but so far I haven't been able to find anything anywhere for how I can modify this call to prevent warning output.

遍历代码并在任何地方添加@SuppressWarnings注释都可行,但它也几乎与修复所有警告来源一样痛苦。所以我真正喜欢的是,如果只有某种方式我可以做:

Going through the code and adding a @SuppressWarnings annotation everywhere would work, but it would also be almost as much of a pain as going through and fixing all the warnings' sources. So what I'd really love is if there was just some way I could do:

<javadoc suppressWarrnings="true"

或类似的东西,以使javadoc编译器不输出所有警告消息。是这样的(全局javadoc警告禁用)可能吗?

or something similar, to make the javadoc compiler not output all the warning messages. Is anything like this (global javadoc warning disabling) possible?

推荐答案

ant任务和javadoc工具本身都无法禁用全局警告。

Both the ant task and javadoc tool itself have no way of disabling warnings globally.

我能想到的一个可能的解决方法是将javadoc任务作为来自其余构建的单独ant调用运行。您可以使用-logfile参数来将输出重定向到日志文件而不是控制台。

One possible workaround I can think of is to run the javadoc task as a separate ant call from the rest of the build. You could use the -logfile argument to ant to redirect the output to a log file rather than the console.

这篇关于如何在javadoc编译期间抑制警告(代码库范围)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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