I am developing plugins for a platform that loads plugin classes at runtime, and this platform uses old versions of the javax.persistence API (specifically version 1.0) whereas my plugin requires version 2.1 because it uses hibernate 4.3.5.Final.
I am looking for a way to remove all the classes in the current package 'javax.persistence' and load the newer javax.peristence classes built in my plugin jar at runtime. The platform my plugin runs on is built as a single jar and has all of its dependencies (including javax.persistence) built in the jar using the shade maven plugin, and this is the same for all the dependencies for a plugin.
So is it possible to accomplish this? to be able to replace a dependency on the classpath with a newer version at runtime? If it is not possible, or very hard, I could always fork the platform, and change the pom.xml to exclude javax.peristence classes from being shaded... but that is not preferable...
EDIT: another option is to write a small script to replace the class files in the jar before deploying. At least that will make it so I wouldn't have to manually replace the classes every time I need to update the platform
thanks.