Using OpenRewrite to identify Search API migrations

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

As part of replacing Lucene-specific APIs in Jira with index-agnostic Search APIs, the deprecated APIs have been annotated with @com.atlassian.jira.search.annotations.DeprecatedBySearchApi.

To help identify usages of these deprecated APIs in your application, we've developed an OpenRewrite recipe available at OpenRewrite Search API Recipes.

These recipes were developed as an experimental internal tool. We're releasing them as a courtesy to our partners, as we've seen great success using them ourselves.

We'll make best-effort attempts to address any problems you might encounter, but these recipes don't have an official support status.


Usage

The package com.atlassian.jira.openrewrite:search-api-recipes:1.0.0 contains a recipe com.atlassian.jira.search.FindDeprecatedSearchUses. It can be executed in multiple ways according to the OpenRewrite documentation.

To get started, run this from the directory where your pom.xml file is located:

   mvn org.openrewrite.maven:rewrite-maven-plugin:run \
      -Drewrite.recipeArtifactCoordinates=com.atlassian.jira.openrewrite:search-api-recipes:1.0.0 \
      -Drewrite.activeRecipes=com.atlassian.jira.search.FindDeprecatedSearchUses \
      -Drewrite.exportDatatables=true
Before running the recipe, we recommend to first update to the latest Jira Platform Java API and run a mvn install on your project. This ensures the dependencies are correctly pulled in, as sometimes this can cause problems. 

Output

Usages of any methods, classes, or fields from Jira marked with @DeprecatedBySearchApi will be found, and the source annotated with the marker /*~~>*/, for example:

/*~~>*/com.atlassian.jira.issue.index.IssueIndexManager issueIndexManager;

When the exportDatatables flag is set, details about the usages will be written to CSV files in the target/rewrite/datatables directory:

  • com.atlassian.jira.search.table.FieldUses.csv: Usages of fields marked with @DeprecatedBySearchApi

  • org.openrewrite.java.table.MethodCalls.csv: Usages of methods marked with @DeprecatedBySearchApi

  • org.openrewrite.java.table.TypeUses.csv: Usages of types marked with @DeprecatedBySearchApi

Troubleshooting

See the OpenRewrite FAQ for common issues and troubleshooting guides.

Last modified on Apr 8, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.