Skip to main content

Upgrade to Jackson 3

To upgrade your project from Jackson 2.x to Jackson 3.x, you can use the OpenRewrite recipe org.openrewrite.java.jackson.UpgradeJackson_2_3 from rewrite-jackson.

This recipe will automatically update your Jackson dependencies and apply the necessary code changes to ensure compatibility with Jackson 3.x, including updating package names from com.fasterxml.jackson to tools.jackson where applicable and handling API changes between versions.

You can run the migration recipe using one of the following methods.

The Moderne CLI allows you to run OpenRewrite recipes on your project without needing to modify your build files, against serialized Lossless Semantic Tree (LST) of your project for a considerable performance boost & across projects.

You will need to have configured the Moderne CLI on your machine before you can run the following command.

  1. If project serialized Lossless Semantic Tree is not yet available locally, then build the LST. This is only needed the first time, or after extensive changes:
shell
mod build ~/workspace/
  1. If the recipe is not available locally yet, then you can install it once using:
shell
mod config recipes jar install org.openrewrite.recipe:rewrite-jackson:LATEST
  1. Run the recipe.
shell
mod run ~/workspace/ --recipe org.openrewrite.java.jackson.UpgradeJackson_2_3