如何使用ant在java源代码中检查标签(TODO:等) [英] How to use ant to check for tags (TODO: etc) in java source

查看:20
本文介绍了如何使用ant在java源代码中检查标签(TODO:等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在代码中看到这样的东西很常见,希望只在开发过程中:

it's common to see something like this in code, hopefully only during development:

//XXX: not in production!
String password = "hello"; // getActualPassword(...);
...
catch(Exception e) { /* TODO: Auto-generated catch block*/ }

我希望 ant 能够 a) 警告(在 TODO:/FIXME: 标签上)或失败(在 XXX: 或类似上)
构建服务器是 linux,本地开发并基于 ant.如果不在 Windows 上,至少需要在 linux 上工作.

I would like ant to be able to a) warn (on TODO: / FIXME: tags) or fail (on XXX: or simmilar)
The build server is linux, home grown and based on ant. Would need to work at least on linux if not on windows.

如果替代方案是阻止文件提交,我们也会使用 perforce.
我们也使用 eclipse,但是我认为你不能让它成为一个致命的错误.(是的,有任务视图,但是我希望能够将某些标签提升为构建破坏者)

We also use perforce if an alternative is to block file commits.
We also use eclipse, however I don't think you can make it a fatal error. (yes, there's the tasks view, however I would like to be able to elevate certain tags to build-breakers)

推荐答案

也许你可以使用 Checkstyle.我认为有一个对 TODO 评论的检查,并且 checkstyle 可以作为 Ant 任务运行,这样你就可以实现你想要的.

Maybe you can use Checkstyle. I think there is a check for TODO comments and checkstyle can be run as an Ant task so you might achieve what you want.

这篇关于如何使用ant在java源代码中检查标签(TODO:等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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