Java依赖关系绘图器 [英] Java dependency grapher

查看:43
本文介绍了Java依赖关系绘图器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

从2000年代初期开始,我有一个大型的,杂乱无章的Java项目.

I have a large, old, disorganized java project from the early 2000s.

该项目是使用ant构建的.

The project is built using ant.

没有依赖关系管理,一切都通过在本地存储jar来处理.

There is no dependency management, everything is handled by storing jars locally.

构建脚本的 compile package 目标非常广泛,并且大多数情况下只是编译并随后打包整个项目,并根据需要改组特定于环境的属性文件.

The compile and package targets for the build script are very broad, and mostly just compile and subsequently package the entire project, shuffling environment specific properties files around as needed.

在项目生命周期的某个时候,引入了一些单独的构建目标,以启用用于管理工具等的Web界面.

At some point during the lifespan of the project, a few separate build targets were introduced, to enable a web interface for admin tooling and the like.

但是,由于没有依赖项管理,并且由于buildscript的选择性不高,因此当前过程正在打包整个Web应用程序,并将其与管理工具一起部署,并且两者之间的差异非常小.二.

However, because there is no dependency management, and because the buildscript isn't very selective, the current process is packaging up the entire web application and deploying it along with the admin tools, with a very minimal list of differences between the two.

我目前正在尝试通过弃用和重构ant构建文件并通过CI工具引入构建/部署自动化来使代码库更加合理.

I am currently embarking on attempting to bring sanity to the codebase by deprecating and re-factoring the ant buildfiles and introducing build/deployment automation by way of CI tooling.

作为下一步工作的一部分,我想尝试重构项目结构和构建文件,以仅将需要打包的内容分别打包到管理工具和生产Web应用程序的war文件中,并且希望只编译一次而不是多次.

As a part of the next phase of this effort, I would like to attempt to refactor the project structure and the buildfiles to only package what it needs to package in the war files for the admin tools and production web-application, respectively, and hopefully, only compile one pass instead of several.

要解决此问题,似乎可能需要为给定的JSP建立一个依赖关系列表,或者至少要建立一个Java类列表.手动做腿部动作来追踪某些东西几乎不在我的范围内,但是该项目的范围如此之大,以至于在没有自动化协助的情况下,我什至没有希望在合理的时间内完成任务.

To solve this problem it seems likely that I will need to build a list of dependencies for a given JSP, or at least a list of java classes. Manually doing legwork to track some stuff down is hardly beneath me, but the scope of the project is large enough that without some automated assistance I have no hope of ever completing the task in a reasonable timeframe.

我还没有找到一个解决方案,它不涉及庞大的软件许可,也不涉及已经在使用Maven的项目.

I have yet to find a solution to this that doesn't involve a hefty software license or a project that is already using Maven.

鉴于Eclipse可以从该项目中任意源文件中采用任意方法,并在对应的文件系统上找到我的资源,看来这一定不是一个无法解决的工程难题-

Given that Eclipse can take an arbitrary method from an arbitrary file of source in this project and find me the resource on the file-system that corresponds, it seems as though this must not be an unsolvable engineering quandary -

是否存在免费的(例如在啤酒中,理想情况下也在软件中)解决方案来为此类项目生成依赖图(或类似方法)?

Does there exist a free (as in beer, ideally also as in software) solution to generating a dependency graph (or similar) for a project like this?

如果失败了,那么堆栈溢出的好公民是否可以针对我可能没有考虑过的问题提出不同的解决方法呢?

Failing that, can the good citizens of stack overflow suggest a different approach to my problem I may not have considered?

推荐答案

我看到这个问题被认为是重复的.

I see that this question is considered a duplicate.

希望增加某人未来的Google搜索结果:

In hopes of boosting someone's future google search results:

jdeps 将递归地打印给定类名,类文件或jar到stdout的依赖项,这可能是解决此确切问题的成本最低的解决方案,并且预先包装了JDK 8和以上.

jdeps will recursively print dependencies for a given class name, class file, or jar to stdout, is probably the least cost solution for solving this exact problem, and comes pre-packaged with JDK 8 and above.

我发现,在存在该实用程序之前的一个已有4年历史的问题上,有10个答案被深埋了10个答案,因此,我觉得将其重新发布在这里很有可能网站的未来用户的价值.

I found that buried 10 answers deep on a 4 year old question that was asked prior to the existence of the utility in question, on an answer that received 0 upvotes, so, I feel re-posting it here may be of potential value for future users of the site.

这篇关于Java依赖关系绘图器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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