Re: newb: How to determine package dependencies from one jar?

"Kees Jan Koster" <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <opsknj85ieh1gx1t@likeever>
Dear Dean,

>  Actually, I have seen Jdepend before.  It does metrics from what I
> understand.
>
Yes, it is rather finer grained than you suggest you need. From what you  
tell me, I think your project would benefit from such analysis, even if it  
won't generate warnings directly.

You are trying to find circular dependencies between packages in your  
project. Right?

The root of this issue is the fact that all source code is built in one  
huge blob, rather than as individual packages. EDI's such as Eclipse are  
very helpful by ignoring all package borders when compiling code.

You are trying to analyse the compiled code for dependencies. That is one  
way of solving it. Trouble is, your code is already compiled and probably  
the test cases run, so when you wave the dependency violation to your  
teammates, there is a decent chance that they will say "sure, we'll fix it  
later." Post-compilation checks are simply too late in the process to make  
people fix this.

If you use Ant to build the code, you can split the compilation target up  
into one target for each package. You then limit the class path for each  
compilation to the compilation units that it may legally depend on. That  
way, if your code has illegal dependencies, it will simply
not compile.

Perhaps you could consider writing your own PMD/findbugs/checkstyle rules  
to alert programmers to the problems you are seeing.

As you can tell, I would be reluctant to use BCEL to dig around JAR files  
for this particular purpose. YMMV

Kees Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.