sofastack / sofa-ark

SOFAArk is a light-weight,java based classloader isolation framework.
https://www.sofastack.tech/projects/sofa-boot/sofa-ark-readme/
Apache License 2.0
1.56k stars 497 forks source link

Simplify usage of ark plugin #69

Closed QilongZhang closed 6 years ago

QilongZhang commented 6 years ago

Currently, a common java module can be repackaged into a ark-plugin. Project just imports this ark plugin as dependency instead of origin java module jar, then class isolation can be applied. However, as structure of jar has been changed, sometimes, project should add dependency of origin module just for compiling success. For simplify usage of ark plugin, we would adjust the structure of ark-plugin, then project just needs to import ark plugin individually.

khotyn commented 6 years ago

可以举个例子说明下之前的使用方式和调整后的使用方式的区别吗?

QilongZhang commented 6 years ago

@khotyn 目前 sofarpc 打包 ark plugin,打包配置放在 rpc starter 主 pom.xml 中,这样做的好处是,ark plugin gav 坐标和 rpc starter 一致,只需要添加上 classifer = ark-plugin 即可。这样会带来一个问题:因为ark plugin 和 rpc starter 共用一个 pom 文件,间接依赖依然被引入进来,这些引入的间接依赖实际是不需要的,且容易引起依赖冲突。

简化后: 以 sofarpc 为例,ark plugin 单独使用一个 gav 坐标,命名规范 rpc-sofa-boot-ark-starter , 用户只需要引入该包,即可,保证该ark plugin不会引入其他间接依赖。rpc starter 相关类会 shade 进来。 当然如果使用 sofa rpc api的形式,为了编译通过需要引入 rpc-core 包,scope 设置成 provider