Supporting and testing multiple versions of a software library in a Maven project

Posted by Duncan Jones on Programmers See other posts from Programmers or by Duncan Jones
Published on 2012-11-26T10:47:52Z Indexed on 2012/11/26 11:33 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

My company has several versions of its software in use by our customers at any one time. My job is to write bespoke Java software for the customers based on the version of software they happen to be running.

I've created a Java library that performs many of the tasks I regularly require in a normal project. This is a Maven project that I deploy to our local Artifactory and pull down into other Maven projects when required.

I can't decide the best way to support the range of software versions used by our customers. Typically, we have about three versions in use at any one time. They are normally backwards compatible with one another, but that cannot be guaranteed. I have considered the following options for managing this issue:


Separate editions for each library version

I make a separate release of my library for each version of my company software. Using some Maven cunningness I could automatically produce a tested version linked to each of the then-current company software versions. This is feasible, but not without its technical challenges.

The advantage is that this would be fairly automatic and my unit tests have definitely executed against the correct software version. However, I would have to keep updating the versions supported and may end up maintaining a large collection of libraries.


One supported version, but others tested

I support the oldest software version and make a release against that. I then perform tests with the newer software versions to ensure it still works.

I could try and make this testing automatic by having some non-deployed Maven projects that import the software library, the associated test JAR and override the company software version used. If those projects build, then the library is compatible. I could ensure these meta-projects are included in our CI server builds.


I welcome comments on which approach is better or a suggestion for a different approach entirely. I'm leaning towards the second option.

© Programmers or respective owner

Related posts about java

Related posts about versioning