Migrate from OptaPlanner to Timefold Solver

ai.timefold.solver.migration.FromOptaPlannerToTimefoldSolver

Replaces your method/field calls, GAVs, etc. To replace deprecated methods too, use the recipe ToLatest

Recipe source

GitHub, Issue Tracker, Maven Central

  • groupId: org.openrewrite.recipe

  • artifactId: rewrite-third-party

  • version: 0.5.1

This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.

Usage

This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-third-party:0.5.1 in your build file or by running a shell command (in which case no build changes are needed):

  1. Add the following to your build.gradle file:

build.gradle
plugins {
    id("org.openrewrite.rewrite") version("6.16.1")
}

rewrite {
    activeRecipe("ai.timefold.solver.migration.FromOptaPlannerToTimefoldSolver")
}

repositories {
    mavenCentral()
}

dependencies {
    rewrite("org.openrewrite.recipe:rewrite-third-party:0.5.1")
}
  1. Run gradle rewriteRun to run the recipe.

Definition

  • Change type

    • oldFullyQualifiedTypeName: org.optaplanner.persistence.jackson.api.OptaPlannerJacksonModule

    • newFullyQualifiedTypeName: ai.timefold.solver.jackson.api.TimefoldJacksonModule

    • ignoreDefinition: true

  • Rename package name

    • oldPackageName: org.optaplanner.persistence.jackson

    • newPackageName: ai.timefold.solver.jackson

    • recursive: true

  • Rename package name

    • oldPackageName: org.optaplanner.persistence.jaxb

    • newPackageName: ai.timefold.solver.jaxb

    • recursive: true

  • Rename package name

    • oldPackageName: org.optaplanner.persistence.jsonb

    • newPackageName: ai.timefold.solver.jsonb

    • recursive: true

  • Rename package name

    • oldPackageName: org.optaplanner.persistence.xstream

    • newPackageName: ai.timefold.solver.xstream

    • recursive: true

  • Rename package name

    • oldPackageName: org.optaplanner.persistence.jpa

    • newPackageName: ai.timefold.solver.jpa

    • recursive: true

  • Rename package name

    • oldPackageName: org.optaplanner

    • newPackageName: ai.timefold.solver

    • recursive: true

  • Change property key

    • oldPropertyKey: ^optaplanner\.(.*)

    • newPropertyKey: timefold.$1

    • regex: true

  • Change property key

    • oldPropertyKey: ^(%[^.]*\.)?quarkus\.optaplanner\.(.*)

    • newPropertyKey: $1quarkus.timefold.$2

    • regex: true

  • Change property key

    • oldPropertyKey: ^(%[^.]*\.)?quarkus\.log\.category\."org\.optaplanner"\.level

    • newPropertyKey: $1quarkus.log.category."ai.timefold.solver".level

    • regex: true

  • Change property key

    • oldPropertyKey: ^(%[^.]*\.)?logging\.level\.org\.optaplanner

    • newPropertyKey: $1logging.level.ai.timefold.solver

    • regex: true

  • Change XML attribute

    • elementName: solver

    • attributeName: xmlns

    • newValue: https://timefold.ai/xsd/solver

    • oldValue: https://www.optaplanner.org/xsd/solver

  • Change XML attribute

    • elementName: solver

    • attributeName: xsi:schemaLocation

    • newValue: https://timefold.ai/xsd/solver https://timefold.ai/xsd/solver/solver.xsd

    • oldValue: https://www.optaplanner.org/xsd/solver https://www.optaplanner.org/xsd/solver/solver.xsd

  • Change XML attribute

    • elementName: plannerBenchmark

    • attributeName: xmlns

    • newValue: https://timefold.ai/xsd/benchmark

    • oldValue: https://www.optaplanner.org/xsd/benchmark

  • Change XML attribute

    • elementName: plannerBenchmark

    • attributeName: xsi:schemaLocation

    • newValue: https://timefold.ai/xsd/benchmark https://timefold.ai/xsd/benchmark/benchmark.xsd

    • oldValue: https://www.optaplanner.org/xsd/benchmark https://www.optaplanner.org/xsd/benchmark/benchmark.xsd

  • Change XML attribute

    • elementName: logger

    • attributeName: name

    • newValue: ai.timefold.solver

    • oldValue: org.optaplanner

  • Change XML attribute

    • elementName: logger

    • attributeName: name

    • newValue: ai.timefold.solver

    • oldValue: org.optaplanner

  • Rename Maven property key

    • oldKey: version.org.optaplanner

    • newKey: version.ai.timefold.solver

  • Rename Maven property key

    • oldKey: version.optaPlanner

    • newKey: version.timefold

  • Rename Maven property key

    • oldKey: version.optaplanner

    • newKey: version.timefold

  • Rename Maven property key

    • oldKey: org.optaplanner.version

    • newKey: ai.timefold.solver.version

  • Rename Maven property key

    • oldKey: optaPlanner.version

    • newKey: timefold.version

  • Rename Maven property key

    • oldKey: optaplanner.version

    • newKey: timefold.version

  • Rename Maven property key

    • oldKey: optaplannerVersion

    • newKey: timefoldVersion

  • Rename Maven property key

    • oldKey: optaPlannerVersion

    • newKey: timefoldVersion

See how this recipe works across multiple open-source repositories

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Last updated