

Ask HN: How do you regularly upgrade java libraries in huge code bases? - ravikiranj

I&#x27;m curious as to how other companies or teams upgrade libraries in huge code bases. For my particular use case, I&#x27;m having to deal with an ancient guava java library jar (4-5 years) and any new library I try to add pulls in the latest or a much newer version than I have and wrecks havoc. At this point, I&#x27;m not sure if upgrading guava is worth it given the vast amount of code fixes that needs to be done and runtime issues that will be hard to reproduce. So, I wanted to ask how others upgrade their library jars and keep them up to date.
======
obblekk
It depends on the target. If this is a server, then you could potentially keep
multiple copies of Guava in your lib (with different namespaces) and use the
appropriate one (this will also require some jiggering with the compile flags
for various modules to make sure the right one gets pulled in). It'll add a
lot of bloat, but that may not matter.

If you're deploying to Android... you're kinda screwed. You can't afford the
space to duplicate.

Honestly, I think the best way is the facebook/google way here - upgrade
frequently and aggressively. Which might not be helpful advice after a long
time of not doing exactly that.

~~~
ravikiranj
You are spot on, upgrading frequenty and aggressively is the right way to go
when the libs themselves are on the stable version. I was planning to upgrade
them by release by release to avoid huge updates.

------
eicnix
Try to avoid huge upgrades but update regularly. Create an automated process
that checks at least daily if there are updates and integrate them as fast as
possible. Keeping your frameworks up-to-date is important security wise.

If you use maven take a look at [http://www.mojohaus.org/versions-maven-
plugin](http://www.mojohaus.org/versions-maven-plugin) . This can be
integrated into a maven build and it checks if there are any new versions to
your dependencies.

------
mkrishnan
You should always have sufficient unit tests and integration tests for your
code base. so that you can confidently upgrade all your libraries whenever you
want if the tests pass.

