關(guān)于jar包增量更新分析
jar包增量更新分析
jdk自帶工具jdeps,可分析class依賴關(guān)系(依賴的其它類和jar)。
團(tuán)隊(duì),可以在此工具結(jié)果的基礎(chǔ)上再詳細(xì)分析對比出增量文件;
思路如下:
- jdeps分別分析出舊包和新包的文件依賴關(guān)系。并對比出新增的文件列表、刪除的文件列表,分別加入到待更新的文件列表
- 分析出依賴關(guān)系沒變化的文件列表,分別計(jì)算這些文件在舊包和新包的md5值。如果md5值不同,則表示文件有變化,也加入到待更新的文件列表
jdeps使用舉例:(分析UserController.class)
# -cp指定classpath。多個(gè)classpath之間用“:”分割 # -f 過濾掉jdk文件 # -v 輸出詳細(xì)信息 jdeps -cp ".:../lib/*" -f java.* -v com/ruoyi/project/system/user/controller/UserController.class
輸出結(jié)果:
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包,報(bào)錯問題(It has been compressed and nested jar files must be stored without compression)
報(bào)錯信息
我們在增量更新jar時(shí),有新增的依賴包。
重新打包之后,報(bào)錯:
It has been compressed and nested jar files must be stored without compression.Please check the mechanism userd to create your executable jar file.
報(bào)錯原因
這個(gè)報(bào)錯的大致意思是:
它已經(jīng)被壓縮,嵌套的jar文件必須在沒有壓縮的情況下存儲。請檢查用于創(chuàng)建可執(zhí)行jar文件的機(jī)制。
使用winrar或者7zip解壓工具,點(diǎn)開后修改lib內(nèi)的jar包,修改后重新保存的時(shí)候,對lib內(nèi)的jar包進(jìn)行了重復(fù)壓縮,所以訪問不到。
解決方式
Windows環(huán)境下:
- 添加壓縮包的時(shí)候,算法選擇"存儲"即可。
Linux環(huán)境下:
- jar -xvf jarname.jar(解壓)
- jar -cvf0M jarname.jar .(重新壓縮,-0是主要的)
jar命令:
- -c:create,插件檔案;
- -i:generate-index,為指定的jar檔案創(chuàng)建索引信息;
- -t:list,列出檔案的目錄;
- -u:update,更新檔案信息;
- -x:extract,從檔案中提取指定的 (或全部) 文件;
- -0:no-compress,僅存儲,不使用zip壓縮;
- -v:verbose,在標(biāo)準(zhǔn)輸出中生成詳細(xì)輸出;
- -f:file,檔指定檔案文件名;
- -M:不創(chuàng)建條目的清單文件
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Java中Springboot集成Kafka實(shí)現(xiàn)消息發(fā)送和接收功能
Kafka是一個(gè)高吞吐量的分布式發(fā)布-訂閱消息系統(tǒng),主要用于處理大規(guī)模數(shù)據(jù)流,它由生產(chǎn)者、消費(fèi)者、主題、分區(qū)和代理等組件構(gòu)成,Kafka可以實(shí)現(xiàn)消息隊(duì)列、數(shù)據(jù)存儲和流處理等功能,在Java中,可以使用Spring Boot集成Kafka實(shí)現(xiàn)消息的發(fā)送和接收,感興趣的朋友跟隨小編一起看看吧2025-01-01
Java中ArrayList在foreach里remove的問題詳析
這篇文章主要給大家介紹了關(guān)于Java中ArrayList在foreach里remove問題的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起看看吧2018-09-09
SpringBoot+Elasticsearch實(shí)現(xiàn)數(shù)據(jù)搜索的方法詳解
Elasticsearch是一個(gè)基于Lucene的搜索服務(wù)器。它提供了一個(gè)分布式多用戶能力的全文搜索引擎,基于RESTful?web接口。本文將利用SpringBoot整合Elasticsearch實(shí)現(xiàn)海量級數(shù)據(jù)搜索,需要的可以參考一下2022-05-05
SpringSecurity實(shí)現(xiàn)訪問控制url匹配
本文主要介紹了SpringSecurity實(shí)現(xiàn)訪問控制url匹配,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-08-08
Java基礎(chǔ)學(xué)習(xí)之ArrayList類概述與常用方法
這篇文章主要為大家簡單的介紹Java中ArrayList類的概述、常用方法及存儲字符串并遍歷,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解一下2022-08-08
Spring?Boot實(shí)現(xiàn)文件上傳的兩種方式總結(jié)
應(yīng)用開發(fā)過程中,文件上傳是一個(gè)基礎(chǔ)的擴(kuò)展功能,它的目的就是讓大家共享我們上傳的文件資源,下面這篇文章主要給大家總結(jié)介紹了關(guān)于Spring?Boot實(shí)現(xiàn)文件上傳的兩種方式,需要的朋友可以參考下2023-05-05

