你是否有碰到这个错误:
java.lang.NoClassDefFoundError: XXXXXX
一般这是由同一个软件不同版本导致,然后你会花几个小时尝试统一成一个版本后就解决了。
现在只要下载这个开源的工具depends,然后运行:
java -jar build/libs/depends-1.0-SNAPSHOT.jar com.mycompany.app:my-app:1.0-SNAPSHOT --filter=JsonParseException
你获得一个有用的报告:
broken apis: com.fasterxml.jackson.core.JsonParseException.getMessage()Ljava/lang/String; is only present in [com.fasterxml.jackson.core:jackson-core [2.9.3, 2.9.5, 2.9.4, 2.9.6]]
com.fasterxml.jackson.core.JsonParseException.<init>(Lcom/fasterxml/jackson/core/JsonParser;Ljava/lang/String;Ljava/lang/Throwable;)V is only present in [com.fasterxml.jackson.core:jackson-core [2.9.3, 2.9.5, 2.9.4, 2.7.8, 2.9.6]]
com.fasterxml.jackson.core.JsonParseException.<init>(Lcom/fasterxml/jackson/core/JsonParser;Ljava/lang/String;)V is only present in [com.fasterxml.jackson.core:jackson-core [2.9.3, 2.9.5, 2.9.4, 2.7.8, 2.9.6]]
com.fasterxml.jackson.core.JsonParseException.<init>(Lcom/fasterxml/jackson/core/JsonParser;Ljava/lang/String;Lcom/fasterxml/jackson/core/JsonLocation;)V is only present in [com.fasterxml.jackson.core:jackson-core [2.9.3, 2.9.5, 2.9.4, 2.7.8, 2.9.6]]
|
从列表中选择一个版本!
下载方式:
- git clone https://github.com/bgard6977/depends.git
- ./gradlew build
工作原理:
- 它使用ShrinkWrap Resolver构建项目的依赖关系图。
- 它扫描每个jar中的类,并使用ASM4查找函数调用。
- 它构建了所有跨模块函数调用的映射。
- 它假设从外部模块调用的任何函数都是公共API。
- 它会比较每个模块的所有版本,以查看所有版本中不存在哪些方法。
- 它按给定的搜索词过滤这些内容。
- 最后,它打印一份报告,以帮助您确定在依赖性冲突产生时使用的版本。