30 Star 63 Fork 19

zzyijia / JarDetectUtil

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

#JarDetectUtil

这个工具用来检测项目中的jar包冲突、jar包缺失、jar包循环依赖等问题

dist目录下的exe文件或jar文件可以直接运行!

软件界面如下

输入图片说明

#简要说明 CheckConfig类用来设置检测参数

1)设置哪些package不需要检测,默认已经将jdk下的Jar包目录设置为忽略

2)设置待检测目录下的哪些jar包可以忽略

setCheckConfig(String propertyFilePath)//通过指定properties文件来设置
setCheckConfig(String ignorePackagesStr, String ignoreJarsStr, String conflictFileTypes)//直接设置

JarChecker类为主要的检测方法(超过10个jar包时默认会开启多线程处理)

check(String dirPath)//核心检测方法,dirPath为目录名称,多目录时可以以;隔开
getCompleteCount()//获得当前已经完成的检测数量
getJarFileCount(String dirPath)//获得目录下的jar包数量

JarConflictDetectUtil类用来检测jar包间是否有冲突

getConflict(pathname)//检测jar包是否有冲突

JarDetectAPP类为用swing编写的简单软件界面。

#example 参考example.Test类

示例代码:

CheckConfig checkConfig = new CheckConfig();
List<JarInfo> lst = new JarChecker(checkConfig).check("D:/temp/lib1;D:/temp/lib2");
for(JarInfo jar:lst){
    System.out.println(jar);
    System.out.println(jar.getBuildVersion());//编译时版本
    System.out.println(jar.getDependentClasses());
    System.out.println(jar.getDependentJars());
    System.out.println(jar.getCycleJars());//循环依赖
    System.out.println(jar.getTroubleClasses());//缺失的类
}
//冲突问题,多目录以;隔开
HashMap<String, HashSet<String>> conflictMap=new JarConflictDetectUtil(checkConfig).getConflict(pathname);
The MIT License (MIT) Copyright (c) 2015 zzyijia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

java项目中的jar包检测小工具,可以检测出jar包冲突、jar包依赖、类缺失、编译运行时jdk版本不当等问题。 依赖问题:发现jar包间的循环依赖问题,jar包间存在循环依赖往往说明设计不良。 冲突问题:不同jar含有相同类即为jar包冲突,jar包冲突可能引起诡异的系统问题。 缺失问题:被引用的类在所有jar中均不存在,缺失问题可能在某一时刻导致系统不能运行。 编译问题:检测所有jar包是否适合在当前环境下运行,运行时jdk版本应当高于所有jar编译时jdk版本。 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/zzyijia/JarDetectUtil.git
git@gitee.com:zzyijia/JarDetectUtil.git
zzyijia
JarDetectUtil
JarDetectUtil
master

搜索帮助