seata Replacing DruidIsolationClassLoader with maven-shade-plugin

mznpcxlj  于 22天前  发布在  Druid
关注(0)|答案(3)|浏览(17)

Why you need it?

https://github.com/seata/seata/blob/develop/sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/DruidIsolationClassLoader.java
为了保证我们使用的druid与用户的隔离,目前采用了classloader形式隔离,导致了在这个包名路径下用户无法扩展sqlparser的问题,希望通过maven-shade-plugin插件来达到去除DruidIsolationClassLoader,并保证我们与用户的druid无依赖冲突

How it could be?

A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it.

Add any other context or screenshots about the feature request here.

bwitn5fc

bwitn5fc1#

现在大概能想到的方案有两个 @a364176773

  1. 使用maven-shade-plugin对com.alibaba.druid进行shade改掉包名,这样seata内部使用的druid的类包名与用户的包名不一致,不会出现依赖冲突。不过这个方案需要对seata中使用了druid的module如seata-sqlparser-druid和rm-datasource等都进行shade,不是很优雅。
  2. 另开一个项目单独使用maven-shade-plugin对com.alibaba.druid进行shade改掉包名并打包,打出一个seata专用的seata-druid包。seata内部使用的druid的module都改用seata-druid,这样也不会出现依赖冲突,也不会出现druid的地方需要多次shade。

现在datastax对于guava的处理就是第2种方案 https://github.com/orgs/datastax/repositories?type=all

dnph8jn4

dnph8jn42#

现在大概能想到的方案有两个 @a364176773

  1. 使用maven-shade-plugin对com.alibaba.druid进行shade改掉包名,这样seata内部使用的druid的类包名与用户的包名不一致,不会出现依赖冲突。不过这个方案需要对seata中使用了druid的module如seata-sqlparser-druid和rm-datasource等都进行shade,不是很优雅。
  2. 另开一个项目单独使用maven-shade-plugin对com.alibaba.druid进行shade改掉包名并打包,打出一个seata专用的seata-druid包。seata内部使用的druid的module都改用seata-druid,这样也不会出现依赖冲突,也不会出现druid的地方需要多次shade。

现在datastax对于guava的处理就是第2种方案 https://github.com/orgs/datastax/repositories?type=all

@slievrly@jsbxyyx PTAL

omqzjyyz

omqzjyyz3#

方案1我个人也不是很赞成,方案2的话有助于编写测试用例,否则因为还未打包shade未生效,无法测试shade的能力是否生效

相关问题