I have two different versions of the same third-party library, and need to deploy to two different systems. Each system uses a different version of the library.
LibraryA and LibraryB have the same API interface and my code is currently built with LibraryA and deployed to SystemA. Now I need a second version that is built with LibraryB and deployed to SystemB.
Of course I could copy/paste my code and compile each project with a different library, but this seems like a maintenance nightmare. Both libraries can be installed and developed against concurrently. Currently I am using Ant, but everything is on the table and anything that could help would be considered.
I managed to get this working with an enhanced Ant build files and Eclipse settings. This fulfilled our requirements of a temporary ability to toggle Libraries in Eclipse, Compile/Test using both Libraries and deploy to different environments.
The Ant build script originally compiled and tested over LibraryA and I copied and pasted another section for LIbraryB. This allows the project to compile with both LibraryA and LibraryB and runs JUnint tests over both libraries.
The startup script was modified to java -cp "Project.jar:$SYMLINK_LIB/*" project.main [space delimited arguments]
$SYMLINK_LIB contains symlinks to the jar libraries differing between two different environments.
Eclipse Configuration