是否有工具可以发现类路径中的多个jar中是否存在相同的类? [英] Is there a tool to discover if the same class exists in multiple jars in the classpath?

查看:117
本文介绍了是否有工具可以发现类路径中的多个jar中是否存在相同的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果你的类路径中有两个包含相同类的不同版本的jar,则classpath顺序变得至关重要。

If you have two jars in your classpath that contain different versions of the same class, the classpath order becomes critical.

我正在寻找一种可以检测的工具并在给定的类路径或文件夹集中标记此类潜在冲突。

I am looking for a tool that can detect and flag such potential conflicts in a given classpath or set of folders.

当然是一个开始的脚本:

Certainly a script that starts:

classes=`mktemp`
for i in `find . -name "*.jar"`
do
    echo "File: $i" > $classes
    jar tf $i > $classes
    ...
done

有一些聪明的排序/ uniq / diff / grep / awk后来有潜力,但我想知道是否有人知道任何现有的解决方案。

with some clever sort/uniq/diff/grep/awk later on has potential, but I was wondering if anyone knows of any existing solutions.

推荐答案

Tattletale 工具是另一个候选人:如果一个类/包位于多个JAR文件中,则发现

The Tattletale tool from JBoss is another candidate: "Spot if a class/package is located in multiple JAR files"

这篇关于是否有工具可以发现类路径中的多个jar中是否存在相同的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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