03 为什么 Bootstrap 代理之后能使用 maven 来管理 rcp 项目的依赖

2024-03-15 10:59

本文主要是介绍03 为什么 Bootstrap 代理之后能使用 maven 来管理 rcp 项目的依赖,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

前言

呵呵 这里会大致的跟一些 可能有帮助于理解 使用 maven 来管理 rcp 项目的依赖 的一些记录信息  

当然 不了解也没关系 

 

 

业务代码使用 sqlite.JDBC

 

 

看 sqlite.JDBC 的加载 

可以看到的是 Activator 触发了 sqlite.JDBC 的加载 

这里面的 Classloader 实例, ModuleClassLoader 的实例, 实际上的实现是 org.eclipse.osgi.internal.loader.EquinoxClassLoader 

可以看到这一系列的加载非常复杂, 我们还是看一些重点吧, 类加载的路由部分主要是委托给了这里的 ClasspathManager 来寻找 

从下面的图片也可以看到, 这里的 cpEntries 大概是有 31 个, 对应的就是 各个 jar, 也就是我们 pom.xml 里面配置的各个 plugin.jar 以及 sqlite.jar 以及 commons-io.jar 可以参见后面的 "cpEntries 包含了那些?" 

可以看到的是在 /Users/jerry/.m2/repository/org/xerial/sqlite-jdbc/3.32.3.2/sqlite-jdbc-3.32.3.2.jar 中发现了 sqlite.JDBC, 然后 就走了后面的从 sqlite-jdbc-3.32.3.2.jar 中加载 sqlite.JDBC defineClass 的相关流程 

 

 

cpEntries 包含了那些数据?

我们这里吧 cpEntries 列出来 大致的结构是 

*.plugin.* 相关的差不多是 24 个依赖 

sqlite.jar, commons-io.jar 两个业务依赖 

idea_rt.jar 一个 jdk 的基础依赖 

$base.dir/target/classes, $base.dir, $base.dir[target/classes], $base.dir/libs/sqlite.jar 四个其他依赖

0 = "/Users/jerry/EclipseWorkStations/MyRcp/target/classes"
1 = "/Users/jerry/.p2/pool/plugins/org.eclipse.equinox.launcher_1.6.0.v20200915-1508.jar"
2 = "/Users/jerry/.p2/pool/plugins/javax.inject_1.0.0.v20091030.jar"
3 = "/Users/jerry/.p2/pool/plugins/org.eclipse.swt_3.115.100.v20201202-1103.jar"
4 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.model.workbench_2.1.900.v20201014-0742.jar"
5 = "/Users/jerry/.p2/pool/plugins/org.eclipse.jface_3.22.0.v20201106-0834.jar"
6 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.services_1.4.0.v20201014-0944.jar"
7 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.workbench_1.12.0.v20201119-1132.jar"
8 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.di_1.7.600.v20200428-0912.jar"
9 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.di_1.2.900.v20201021-1339.jar"
10 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.contexts_1.8.400.v20191217-1710.jar"
11 = "/Users/jerry/.p2/pool/plugins/org.eclipse.core.runtime_3.20.0.v20201027-1526.jar"
12 = "/Users/jerry/.p2/pool/plugins/org.eclipse.core.commands_3.9.800.v20201021-1339.jar"
13 = "/Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.di.annotations_1.6.600.v20191216-2352.jar"
14 = "/Users/jerry/.p2/pool/plugins/org.eclipse.osgi_3.16.100.v20201030-1916.jar"
15 = "/Users/jerry/.p2/pool/plugins/org.eclipse.osgi.compatibility.state_1.2.200.v20200915-2015.jar"
16 = "/Users/jerry/.p2/pool/plugins/org.eclipse.equinox.common_3.14.0.v20201102-2053.jar"
17 = "/Users/jerry/.p2/pool/plugins/org.eclipse.core.jobs_3.10.1000.v20200909-1312.jar"
18 = "/Users/jerry/.p2/pool/plugins/org.eclipse.equinox.registry_3.10.0.v20201107-1818.jar"
19 = "/Users/jerry/.p2/pool/plugins/org.eclipse.equinox.preferences_3.8.100.v20201102-2042.jar"
20 = "/Users/jerry/.p2/pool/plugins/org.eclipse.core.contenttype_3.7.800.v20200724-0804.jar"
21 = "/Users/jerry/.p2/pool/plugins/org.eclipse.equinox.app_1.5.0.v20200717-0620.jar"
22 = "/Users/jerry/.p2/pool/plugins/javax.annotation_1.3.5.v20200909-1856.jar"
23 = "/Users/jerry/.p2/pool/plugins/org.eclipse.swt.browser.chromium.cocoa.macosx.x86_64_3.115.100.v20201202-1103.jar"
24 = "/Users/jerry/.p2/pool/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.115.100.v20201202-1103.jar"
25 = "/Users/jerry/.m2/repository/org/xerial/sqlite-jdbc/3.32.3.2/sqlite-jdbc-3.32.3.2.jar"
26 = "/Users/jerry/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar"
27 = "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar"
28 = "/Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/EclipseWorkStations/MyRcp[target/classes/]"
29 = "/Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/EclipseWorkStations/MyRcp"
30 = "/Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/EclipseWorkStations/MyRcp/libs/sqlite-jdbc-3.32.3.2.jar"

 

 

ClasspathManager 里面的 cpEntries 来自于哪里?

ClasspathManager 的创建是在 EquinoxClassLoader 里面 

我们在 ClasspathManager 里面打上断点 

... 然后我们会发现 N 个进入 ClasspathManager 的断点?, 创建了这么多的 EquinoxClassLoader ?  

我们可以稍微打印一下这些 EquinoxClassLoader 的相关上下文信息, 一些是 *.plugin.*, 另外还有一个而我们需要关注的 MyRcp 

entryLength = 31, firstBundle = /Users/jerry/EclipseWorkStations/MyRcp/target/classes

 inClasspathManager - entryLength = 1, firstBundle = /Users/jerry/.p2/pool/plugins/org.eclipse.osgi_3.16.100.v20201030-1916.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.apache.felix.scr_2.1.24.v20200924-1939.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.osgi.services_3.9.0.v20200511-1725.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.equinox.common_3.14.0.v20201102-2053.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.osgi.util_3.5.300.v20190708-1141.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.core.contenttype_3.7.800.v20200724-0804.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.equinox.preferences_3.8.100.v20201102-2042.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.equinox.registry_3.10.0.v20201107-1818.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.di.extensions.supplier_0.15.700.v20200622-1247.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.di_1.7.600.v20200428-0912.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.core.runtime_3.20.0.v20201027-1526.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.equinox.app_1.5.0.v20200717-0620.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.equinox.event_1.5.500.v20200616-0800.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.workbench.swt_0.15.0.v20201103-0952.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.jface_3.22.0.v20201106-0834.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.model.workbench_2.1.900.v20201014-0742.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.services_2.2.500.v20200928-2213.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.workbench_1.12.0.v20201119-1132.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.contexts_1.8.400.v20191217-1710.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.swt_3.115.100.v20201202-1103.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.services_1.4.0.v20201014-0944.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/javax.inject_1.0.0.v20091030.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.di.annotations_1.6.600.v20191216-2352.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/javax.annotation_1.3.5.v20200909-1856.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.emf.ecore_2.23.0.v20200630-0516.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.emf.common_2.21.0.v20200917-1439.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.emf.ecore.xmi_2.16.0.v20190528-0725.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.emf.ecore.change_2.14.0.v20190528-0725.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.emf.xpath_0.2.800.v20200609-0849.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.emf.databinding_1.5.0.v20180706-1146.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.workbench.renderers.swt_0.15.0.v20201125-0918.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.workbench.addons.swt_1.4.0.v20201119-1132.jarinClasspathManager - entryLength = 31, firstBundle = /Users/jerry/EclipseWorkStations/MyRcp/target/classesinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.core.commands_3.9.800.v20201021-1339.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.core.databinding.observable_1.10.0.v20200730-0848.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.jface.databinding_1.12.100.v20201014-0742.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.di_1.2.900.v20201021-1339.jar
org.sqlite.JDBC
E4LifeCycle.postContextCreateinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.commands_0.13.0.v20201119-1132.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.bindings_0.13.0.v20201119-1132.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.core.di.extensions_0.16.0.v20200507-0938.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.css.core_0.13.0.v20201015-0653.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.css.swt.theme_0.13.0.v20201026-1147.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.css.swt_0.14.0.v20201103-0952.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.w3c.css.sac_1.3.1.v200903091627.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.apache.batik.css_1.13.0.v20200622-2037.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.apache.batik.i18n_1.13.0.v20200622-2037.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.apache.batik.util_1.13.0.v20200622-2037.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.widgets_1.2.800.v20201021-1339.jarinClasspathManager - entryLength = 1, firstBundle = /Applications/Eclipse.app/Contents/Eclipse/../../../../Users/jerry/.p2/pool/plugins/org.eclipse.e4.ui.workbench3_0.15.500.v20201021-1339.jar

 

这些 module 来自于 /Users/jerry/EclipseWorkStations/.metadata/.plugins/org.eclipse.pde.core/MyRcp.product/org.eclipse.osgi/framework.info.8 解析出来的 module 部分的信息 

这个文件里面包含了 一些常规信息, 版本, 时间, 权限信息, 以及这里的 模块的相关信息, 具体的过程可以参见  Storage.<init> 

 

 

回到主题, 我们这里需要关注的是 MyRcp 对应的这个 EquinoxClassLoader 

读取 MyRcp 对应的额 classpath 读取出来的数据大致如下, 看起来就是 dev.properties 里面的配置 

 

配置的加载来自于 初始化 EquinoxConfiguration 的时候, 配置文件来自于 osgi.dev 的配置 

 

这个 osgi.dev 的配置 来自于参入的 程序参数[Program arguments]

 

 

扩展

现在能够反向的理解 使用 maven 来管理 rcp 项目的依赖 了么?

至于我最开始怎么知道修改 dev.properties 的? 你猜 ~ little tricks[占位符] 

 

 

完 

 

 

参照

使用 maven 来管理 rcp 项目的依赖

 

 

这篇关于03 为什么 Bootstrap 代理之后能使用 maven 来管理 rcp 项目的依赖的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/811741

相关文章

这15个Vue指令,让你的项目开发爽到爆

1. V-Hotkey 仓库地址: github.com/Dafrok/v-ho… Demo: 戳这里 https://dafrok.github.io/v-hotkey 安装: npm install --save v-hotkey 这个指令可以给组件绑定一个或多个快捷键。你想要通过按下 Escape 键后隐藏某个组件,按住 Control 和回车键再显示它吗?小菜一碟: <template

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

Makefile简明使用教程

文章目录 规则makefile文件的基本语法:加在命令前的特殊符号:.PHONY伪目标: Makefilev1 直观写法v2 加上中间过程v3 伪目标v4 变量 make 选项-f-n-C Make 是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make 可以自动化地执行编译、链接等一系列操作。 规则 makefile文件

每天认识几个maven依赖(ActiveMQ+activemq-jaxb+activesoap+activespace+adarwin)

八、ActiveMQ 1、是什么? ActiveMQ 是一个开源的消息中间件(Message Broker),由 Apache 软件基金会开发和维护。它实现了 Java 消息服务(Java Message Service, JMS)规范,并支持多种消息传递协议,包括 AMQP、MQTT 和 OpenWire 等。 2、有什么用? 可靠性:ActiveMQ 提供了消息持久性和事务支持,确保消

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

使用opencv优化图片(画面变清晰)

文章目录 需求影响照片清晰度的因素 实现降噪测试代码 锐化空间锐化Unsharp Masking频率域锐化对比测试 对比度增强常用算法对比测试 需求 对图像进行优化,使其看起来更清晰,同时保持尺寸不变,通常涉及到图像处理技术如锐化、降噪、对比度增强等 影响照片清晰度的因素 影响照片清晰度的因素有很多,主要可以从以下几个方面来分析 1. 拍摄设备 相机传感器:相机传

高效+灵活,万博智云全球发布AWS无代理跨云容灾方案!

摘要 近日,万博智云推出了基于AWS的无代理跨云容灾解决方案,并与拉丁美洲,中东,亚洲的合作伙伴面向全球开展了联合发布。这一方案以AWS应用环境为基础,将HyperBDR平台的高效、灵活和成本效益优势与无代理功能相结合,为全球企业带来实现了更便捷、经济的数据保护。 一、全球联合发布 9月2日,万博智云CEO Michael Wong在线上平台发布AWS无代理跨云容灾解决方案的阐述视频,介绍了

综合安防管理平台LntonAIServer视频监控汇聚抖动检测算法优势

LntonAIServer视频质量诊断功能中的抖动检测是一个专门针对视频稳定性进行分析的功能。抖动通常是指视频帧之间的不必要运动,这种运动可能是由于摄像机的移动、传输中的错误或编解码问题导致的。抖动检测对于确保视频内容的平滑性和观看体验至关重要。 优势 1. 提高图像质量 - 清晰度提升:减少抖动,提高图像的清晰度和细节表现力,使得监控画面更加真实可信。 - 细节增强:在低光条件下,抖