Using Maven to Port Multiple version of the same code

As you can tell, I am a maven power user.  I use it for most of my projects (sometimes we run into pure Eclipse, Gradle and Ant). 

I started work on porting one version of the exact version of one model to a new version of the same model (same classes). I need to use both JARs in the same classpath.  This leads to a problem – how to use both at the same time.  

I like to use the maven-shade-plugin and relocate the class files such that package.class-file is relocated to package.old.class-file.  Generally this works well (except where you use reflexsive pathing in Class.forName to look up a class). I was able to prepend a string before shading the class.

The pom.xml I used is much like the attached project.  I hope this helps you all.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.