Upgrade from OptaPlanner
In spring of 2024, Red Hat announced end of life for OptaPlanner. Timefold Solver is a faster, feature-rich, and actively developed fork of OptaPlanner.
Upgrading from OptaPlanner to Timefold Solver Community Edition only takes two minutes. Run the command below to upgrade your code automatically.
-
Maven
-
Gradle
mvn org.openrewrite.maven:rewrite-maven-plugin:5.46.1:run -Drewrite.recipeArtifactCoordinates=ai.timefold.solver:timefold-solver-migration:SNAPSHOT -Drewrite.activeRecipes=ai.timefold.solver.migration.ToLatest
curl https://timefold.ai/product/upgrade/upgrade-timefold.gradle > upgrade-timefold.gradle ; gradle -Dorg.gradle.jvmargs=-Xmx2G --init-script upgrade-timefold.gradle rewriteRun -DtimefoldSolverVersion=SNAPSHOT ; rm upgrade-timefold.gradle
Having done that, do a test run of the solver and commit the changes. If it doesn’t work, just revert it instead and submit an issue. We’ll fix it with the highest priority.
Timefold Solver 1.x is backward compatible with OptaPlanner 8.x, except for the following changes:
-
Minimum Java 17 (LTS). Java 21 (LTS) and the latest Java version are also supported.
-
The Maven/Gradle GAVs changed:
-
The groupId changed from
org.optaplanner
toai.timefold.solver
. -
The artifactIds changed from
optaplanner-*
totimefold-solver-*
. -
ArtifactIds containing
peristence-
changed fromoptaplanner-persistence-*
totimefold-solver-*
.-
For example,
optaplanner-persistence-jackson
changed totimefold-solver-jackson
.
-
-
-
The import statements changed accordingly:
-
import org.optaplanner…;
changed toimport ai.timefold.solver…;
. -
import org.optaplanner.persistence…;
changed toimport ai.timefold.solver…;
too.
-
-
The JEE dependencies changed from
javax
tojakarta
to accommodate Spring 3 and Quarkus 3.-
This is the same difference as between OptaPlanner 8.x and OptaPlanner 9.x.
-
-
The
OptaPlannerJacksonModule
class is now calledTimefoldJacksonModule
. -
The deprecated
scoreDRL
support is removed, because Drools with its transitive dependencies have been removed entirely. -
The unsecure module
persistence-xstream
is removed, because of old, unresolved CVEs in XStream. -
The deprecated, undocumented
ScoreHibernateType
has been removed because of Jakarta. Use JPA’sScoreConverter
instead.
Timefold Solver 1.x does not support scoreDRL
, nor is it upgraded automatically.
If you’re still using scoreDRL
from OptaPlanner 7.x,
please upgrade to Constraint Streams first.
All other deprecated code remains to make upgrading easy.