How to deal with major platform / dependency updates?

Look for some guidelines for handling major dependency updates within a project, suggesting using a dependency management tool (such as Maven 2).

In particular, I'm interested in:

  • How to get a legacy application up to date (e.g. Spring 1.2.x to 2.5.x)
  • What methods can be implemented after such a major overhaul to keep applications up to date.

Your own experience or any articles / articles that you have met / found useful are welcome.

EDIT: Updating the version number of dependencies is trivial. I'm more looking for how you solve the changes you need to make based on dependency changes (deprecation, deletion, type changes in parameters / return values, etc.). And if there is a good way to facilitate these changes in the future, since keeping your dependencies up to date should allow you to stay on top of the changes and prevent a lot of time by spending the β€œsafer x 2.1” feature.

+7
java dependency-management upgrade
source share
2 answers

In my experience, dependency updates are implemented because of the necessary functionality that belongs to dependencies, as a bug fix for a dependency that directly affects your own code, to support a new version of Java, or to ensure compatibility with your code to a specific standard (regarding dependencies affecting safety). If your code does not fall into one of these areas as needed, I would not keep them up to date, but instead updated them only as needed, since updating from release to release can actually introduce errors into your application.

I always found that best practice starts with completing production on your application for the loop, releasing it as a stable build and manually updating dependencies in the next development iteration. Centralizing your versions in the parent POM will result in minimal dependency version modification and increased extensibility. Assuming you are using Maven:

<dependency> <groupId>your.dep.group</groupId> <artifactId>your-artifact-id</artifactId> <version>${desiredVersion}</version> </dependency> 
+1
source share

Good methods for handling dependency changes are the same as effective methods for designing applications. You want to overlay your architecture and minimize the ubiquitous connection of your code with each dependency, in order to preserve isolated changes so that updating the dependency does not interrupt every part of your application. Code for interfaces and keep business logic separate from infrastructure code.

With minor updates (updating dependency dependency points) this helps if you have a complete set of unit tests to detect failures due to API changes. This is one of the main reasons why it sometimes helps to write trivial tests that seem always useful at first glance. An example of this is writing a simple JDBC unit test to perform a simple query. This seems like a waste of time until you catch the problem with the JDBC driver after updating the database (this happened to me).

For big changes (like upgrading between incompatible versions of a framework like Spring), this helps if you have some automated functional or integration tests, or at least have a functional specification that your QA staff can go through to check the high level level. Unit tests will most likely no longer matter if the infrastructure API you are updating is different enough to require wide code changes.

The actual tactical part of managing the transition from one version of the addiction to another incompatible really depends on what you are doing. A mature library will provide some kind of migration path and hopefully does not require you to rewrite everything. It is recommended to separate code changes associated with updating the infrastructure from changes related to the introduction of a new feature. Thus, if something breaks, you will find out that it is connected with updating the framework, and not with something that you violated when implementing the new function.

Part of what makes this so difficult is that at run time you can only have one version of a specific dependency in your JVM, so you need to update all the code right away. OSGi solves this problem by allowing different OSGi paths to work the same way to depend on different versions of dependencies, so you can depend on different versions of dependencies at runtime. So Eclipse manages dependencies for plugins without breaking other plugins.

+1
source share

All Articles