1

Problem:

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

The project is built using ant.

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

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.

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.

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.

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.

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.

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.

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.

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?

Iron Gremlin
  • 407
  • 2
  • 11
  • 3
    While I am very sympathetic to your issues, I must tell you that product recommendations such as this are off-topic on this site. – Joe C Oct 26 '18 at 18:26
  • @JoeC I see your point. I am open to suggestions regarding re-wording the question as asked to make this more clear, but, honestly I'd consider merely linking a specific product to be a unsatisfactory answer to this question anyway. What I'm looking for is some kind of mechanism or methodology used by members of the ecosystem to resolve these kinds of problems in existing projects. – Iron Gremlin Oct 26 '18 at 18:48
  • Duplicate of [tool to generate graph data for class dependencies](https://stackoverflow.com/q/19807372/5221149) – Andreas Oct 26 '18 at 19:25
  • Duplicate of [draw dependency graph for a java class](https://stackoverflow.com/q/1797384/5221149) – Andreas Oct 26 '18 at 19:26
  • Duplicate of [Dependency map for Java classes and methods](https://stackoverflow.com/q/2366811/5221149) – Andreas Oct 26 '18 at 19:27
  • Duplicate of [View classes dependency graph plugin](https://stackoverflow.com/q/1005479/5221149) – Andreas Oct 26 '18 at 19:27

1 Answers1

2

I see that this question is considered a duplicate.

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

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.

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.

Iron Gremlin
  • 407
  • 2
  • 11