需要一个Java包依赖分析工具
无论如何,是否可以使用 jDepend、ant contrib 的 verifydesign 任务或任何其他类似的工具(使用黑名单而不是白名单)来运行包依赖性分析?
也就是说,我希望不那么严格(至少一开始是这样)。而不是指定包 A 必须仅依赖于 B、C 和 K;包 B 必须仅依赖于 Q、W 和 R;等等,对于系统中的每个包裹,我首先想说的是:包裹A绝对不能与W和Y以及其他任何东西有任何联系对我来说没问题。随着时间的推移,随着事情的重构,我可以逐渐添加每个包的预期依赖项的完整列表(A 仅依赖于 B、C、K)。
那么是否有工具可以做到这一点?
Is there anyway to run a package dependency analysis using jDepend, ant contrib's verifydesign task, or any other similar tool, which uses blacklists instead of whitelists?
That is to say, I want to be far less strict (at least initially). Instead of specifying package A must only depend on B, C and K; package B must only depend on Q, W and R; etc. for every package in the system, I'd like to begin by saying: package A absolutely can't have any contact with W and Y, and anything else it does is alright by me. I could then gradually add in the full list of expected dependencies (A depends on only B, C, K) for each package over time, as things are refactored.
So does a tool exist to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可以做得更好:您可以在 AspectJ AOP 中表达此类内容,以便可以在运行时强制执行。 “AspectJ 实际操作”向您展示了如何操作。
I can do one better: you can express such things in AspectJ AOP so that it can be enforced at runtime. "AspectJ In Action" shows you how.
verifydesign 可以不那么严格,因为您可以定义一个“wad”,可以这么说,并使其变得越来越严格。指向一篇文章的链接,其中有一篇关于遗留系统的文章(这些系统通常违反了大量的预期设计)。
http://www.devx.com/opensource/Article/33729/0 /页/4
verifydesign can be less strict in that you can define a "wad" so to speak and make it more and more strict. A link to an article that has a piece on legacy systems(which are typically violating tons of the intended design).
http://www.devx.com/opensource/Article/33729/0/page/4
您可以使用 Structure101 架构图 来完成此操作这些图表可以包含代码库的子集。在您的示例中,您可以在图中为 A、W 和 Y 创建 3 个单元格,将 W 和 Y 放置在图中 A 上方(依赖关系只能向下流动,或者至少向上依赖关系被视为“违反”图表) )。将 W 和 Y 并排放置在 A 上方表示 W 和 Y 之间不应该存在依赖关系。如果您不想限制 W 和 Y 之间的依赖关系(还),可以将它们合并到单个单元格中,然后将它们合并到一个单元格中。 - 不会检查依赖关系。规则会自动检查,您可以生成警告和/或错误(如果需要,可以中断构建)。随着重构工作的进展,您可以逐渐添加到图表中......
You can do this with Structure101 Architecture Diagrams since the diagrams can contain a subset of your codebase. In your example, you could create 3 cells in the diagram for A, W and Y, placing W and Y above A in the diagram (dependencies can only flow downwards, or at least an upward dependency is considered a "violation" of the diagram). Placing W and Y side-by-side above A says that there should be no dependencies between W and Y. If you don't want to restrict dependencies between W and Y (yet), you can merge them into a single cell and inter-dependencies will not be checked. The rules are automatically checked and you can generate warnings and/or errors (break the build if you want). And you can gradually add to the diagram as your refactoring effort progresses...