paypal / butterfly

Application transformation tool
https://paypal.github.io/butterfly/
MIT License
48 stars 50 forks source link

Add support for extensions packaged as spring-boot uber jar #364

Closed myohn-paypal closed 4 years ago

myohn-paypal commented 4 years ago

Add support for loading butterfly extension jars that are packaged as spring-boot uber jar.

To make it easier for an extension to include its own transitive depdencies, change butterfly so that it can load extension jars that contain nested jars created by spring-boot maven plugin.

fabiocarvalho777 commented 4 years ago

That is a good feature request. It will require classpath isolation though, not a very trivial problem to solve.

myohn-paypal commented 4 years ago

Yes, this issue is for allowing more dependencies to be easily added. Classloader isolation will be done in a separate issue / pull request.

fabiocarvalho777 commented 4 years ago

So, you mentioned classpath isolation will be done in a separated PR. With the current changes you provided, what happens if there are two extensions installed, and they both use the same library, but in different versions? Wouldn't that cause a conflict?

myohn-paypal commented 4 years ago

With current changes: yup, there would be a conflict if the extension brought in a mismatched version of an existing dependency. It'd just be like placing inconsistent jars on the classpath. The first jar would win and the class would be loaded from there. There is a chance of linkage errors like NoSuchMethodError being thrown.

(In fact, I think butterfly itself has internally inconsistent dependencies. The build should be configured with maven dependency convergence rule or its gradle equivalent

The intent here with this pull request is that the extension can more easily add additional dependencies by dropping a single jar. The extension creator or butterfly deployer still has to be careful in ensuring consistent dependencies.

  With classloader isolation later on, hopefully such problems can be reduced.

fabiocarvalho777 commented 4 years ago

Ok, thanks.