Apache Commons best practices
Recipe ID
org.openrewrite.apache.commons.ApacheCommonsBestPracticesArtifactorg.openrewrite.recipe:rewrite-apacheApply best practices to code that uses Apache Commons libraries: migrate off the end-of-life Commons Lang 2.x, Commons Collections 3.x and Commons Math 2.x major versions, correct the commons-io coordinates, replace deprecated APIs with their supported replacements, make character encodings explicit, and prefer the Java standard library where it now offers an equivalent.
Composite recipecommonsapacheMSAL
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.apache.commons.ApacheCommonsBestPracticesIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-apache:RELEASEDefinition
This recipe runs the following recipes in order.
- Migrates to Apache Commons Collections 4.x
org.openrewrite.apache.commons.collections.UpgradeApacheCommonsCollections_3_4 - Migrates to Apache Commons Lang 3.x
org.openrewrite.apache.commons.lang.UpgradeApacheCommonsLang_2_3 - Migrates to Apache Commons Math 3.x
org.openrewrite.apache.commons.math.UpgradeApacheCommonsMath_2_3 - Relocate
org.apache.commons:commons-iotocommons-io:commons-ioorg.openrewrite.apache.commons.io.RelocateApacheCommonsIo - Use IOUtils method that include their charset encoding
org.openrewrite.apache.commons.io.ApacheIOUtilsUseExplicitCharset - Migrate deprecated SystemUtils constants
org.openrewrite.apache.commons.lang3.MigrateSystemUtilsDeprecations - Prefer the Java standard library instead of Apache Commons
org.openrewrite.apache.commons.PreferJavaStandardLibrary
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats