关于jar包增量更新分析

 更新时间:2024年05月20日 11:17:14   作者:美味豆腐汤  
这篇文章主要介绍了关于jar包增量更新分析,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

jar包增量更新分析

jdk自带工具jdeps,可分析class依赖关系(依赖的其它类和jar)。

团队,可以在此工具结果的基础上再详细分析对比出增量文件;

思路如下:

  • jdeps分别分析出旧包和新包的文件依赖关系。并对比出新增的文件列表、删除的文件列表,分别加入到待更新的文件列表
  • 分析出依赖关系没变化的文件列表,分别计算这些文件在旧包和新包的md5值。如果md5值不同,则表示文件有变化,也加入到待更新的文件列表

jdeps使用举例:(分析UserController.class)

#  -cp指定classpath。多个classpath之间用“:”分割
# -f 过滤掉jdk文件
# -v 输出详细信息
jdeps -cp ".:../lib/*" -f java.* -v com/ruoyi/project/system/user/controller/UserController.class

输出结果:

   com.ruoyi.project.system.user.controller.UserController -> cn.hutool.extra.spring.SpringUtil                  hutool-all-5.8.3.jar
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.constant.Constants                .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.constant.Constants$Command        .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.constant.Constants$ProvinceCode   .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.constant.Constants$ProvinceCode$Telecom10010 .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.exception.BusinessException       .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.utils.Encryption                  .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.utils.RSACoder                    .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.utils.StringUtils                 .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.utils.poi.ExcelUtil               .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.common.utils.security.ShiroUtils         .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.framework.aspectj.lang.annotation.Log    .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.framework.web.controller.BaseController  .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.framework.web.domain.AjaxResult          .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.framework.web.domain.BaseEntity          .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.framework.web.page.TableDataInfo         .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.bizmanage.order.service.IUserPropertyService .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.dept.domain.Dept          .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.dept.service.IDeptService .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.post.service.IPostService .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.role.domain.Role          .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.role.service.IRoleService .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.user.domain.User          .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.user.domain.vo.EditableAttribute .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.user.service.EditableAttributeListConfig .
   com.ruoyi.project.system.user.controller.UserController -> com.ruoyi.project.system.user.service.IUserService .
   com.ruoyi.project.system.user.controller.UserController -> org.apache.shiro.authz.annotation.RequiresPermissions shiro-core-1.12.0.jar
   com.ruoyi.project.system.user.controller.UserController -> org.hibernate.validator.internal.constraintvalidators.bv.EmailValidator hibernate-validator-6.2.5.Final.jar
   com.ruoyi.project.system.user.controller.UserController -> org.slf4j.Logger                                   slf4j-api-1.7.36.jar
   com.ruoyi.project.system.user.controller.UserController -> org.slf4j.LoggerFactory                            slf4j-api-1.7.36.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.beans.factory.annotation.Autowired spring-beans-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.beans.factory.annotation.Value spring-beans-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.stereotype.Controller          spring-context-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.ui.ModelMap                    spring-context-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.util.CollectionUtils           spring-core-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.web.bind.annotation.GetMapping spring-web-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.web.bind.annotation.PathVariable spring-web-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.web.bind.annotation.PostMapping spring-web-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.web.bind.annotation.RequestMapping spring-web-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.web.bind.annotation.ResponseBody spring-web-5.3.27.jar
   com.ruoyi.project.system.user.controller.UserController -> org.springframework.web.multipart.MultipartFile    spring-web-5.3.27.jar

增量更新jar包,报错问题(It has been compressed and nested jar files must be stored without compression)

报错信息

我们在增量更新jar时,有新增的依赖包。

重新打包之后,报错:

It has been compressed and nested jar files must be stored without compression.Please check the mechanism userd to create your executable jar file.

报错原因

这个报错的大致意思是:

它已经被压缩,嵌套的jar文件必须在没有压缩的情况下存储。请检查用于创建可执行jar文件的机制。

使用winrar或者7zip解压工具,点开后修改lib内的jar包,修改后重新保存的时候,对lib内的jar包进行了重复压缩,所以访问不到。

解决方式

Windows环境下:

  • 添加压缩包的时候,算法选择"存储"即可。

Linux环境下:

  • jar -xvf jarname.jar(解压)
  • jar -cvf0M jarname.jar .(重新压缩,-0是主要的)

jar命令:

  • -c:create,插件档案;
  • -i:generate-index,为指定的jar档案创建索引信息;
  • -t:list,列出档案的目录;
  • -u:update,更新档案信息;
  • -x:extract,从档案中提取指定的 (或全部) 文件;
  • -0:no-compress,仅存储,不使用zip压缩;
  • -v:verbose,在标准输出中生成详细输出;
  • -f:file,档指定档案文件名;
  • -M:不创建条目的清单文件

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • Java中Springboot集成Kafka实现消息发送和接收功能

    Java中Springboot集成Kafka实现消息发送和接收功能

    Kafka是一个高吞吐量的分布式发布-订阅消息系统,主要用于处理大规模数据流,它由生产者、消费者、主题、分区和代理等组件构成,Kafka可以实现消息队列、数据存储和流处理等功能,在Java中,可以使用Spring Boot集成Kafka实现消息的发送和接收,感兴趣的朋友跟随小编一起看看吧
    2025-01-01
  • Spring Bean后处理器详细介绍

    Spring Bean后处理器详细介绍

    Bean后置处理器允许在调用初始化方法前后对Bean进行额外的处理。可以在​Spring容器通过插入一个或多个BeanPostProcessor的实现来完成实例化,配置和初始化一个​bean​之后实现一些自定义逻辑回调方法
    2023-01-01
  • 使用阿里云OSS的服务端签名后直传功能的流程分析

    使用阿里云OSS的服务端签名后直传功能的流程分析

    这篇文章主要介绍了使用阿里云OSS的服务端签名后直传功能,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2020-09-09
  • Java中ArrayList在foreach里remove的问题详析

    Java中ArrayList在foreach里remove的问题详析

    这篇文章主要给大家介绍了关于Java中ArrayList在foreach里remove问题的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面来一起看看吧
    2018-09-09
  • SpringBoot+Elasticsearch实现数据搜索的方法详解

    SpringBoot+Elasticsearch实现数据搜索的方法详解

    Elasticsearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。本文将利用SpringBoot整合Elasticsearch实现海量级数据搜索,需要的可以参考一下
    2022-05-05
  • SpringSecurity实现访问控制url匹配

    SpringSecurity实现访问控制url匹配

    本文主要介绍了SpringSecurity实现访问控制url匹配,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2022-08-08
  • Java基础学习之ArrayList类概述与常用方法

    Java基础学习之ArrayList类概述与常用方法

    这篇文章主要为大家简单的介绍Java中ArrayList类的概述、常用方法及存储字符串并遍历,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一下
    2022-08-08
  • Java sdk安装及配置案例详解

    Java sdk安装及配置案例详解

    这篇文章主要介绍了Java sdk安装及配置案例详解,本篇文章通过简要的案例,讲解了该项技术的了解与使用,以下就是详细内容,需要的朋友可以参考下
    2021-08-08
  • Spring Boot实现文件上传的两种方式总结

    Spring Boot实现文件上传的两种方式总结

    应用开发过程中,文件上传是一个基础的扩展功能,它的目的就是让大家共享我们上传的文件资源,下面这篇文章主要给大家总结介绍了关于Spring Boot实现文件上传的两种方式,需要的朋友可以参考下
    2023-05-05
  • javaDSL简单实现示例分享

    javaDSL简单实现示例分享

    DSL领域定义语言,用来描述特定领域的特定表达。比如画图从起点到终点;路由中的从A到B。这是关于画图的一个简单实现
    2014-03-03

最新评论