TimefoldAI / TimefoldAI/timefold-solver

Upgrade from Optaplanner Failure: Missing rewrite() Method in upgrade-timefold.gradle Script

Open
#1,170 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

process/needs triage
Dominant language
Java
Stars
1.8k
Forks
228
Avg merge
1d 13h
Merged PRs (30d)
46

Description

Describe the bug
Gradle build fails with an exception when running the upgrade script for Timefold Solver. The error indicates that the rewrite() method is not found.

Expected behavior
he Gradle build should complete successfully, applying the necessary upgrades without any errors.

Actual behavior
The build fails with the following error message:

No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.rewrite() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [ai.timefold.solver:timefold-solver-migration:1.15.0]
Possible solutions: wait(), wait(long), create(java.lang.Object), with(groovy.lang.Closure)
> Could not find method rewrite() for arguments [ai.timefold.solver:timefold-solver-migration:1.15.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

To Reproduce

  1. Run the following command in the terminal:
curl https://timefold.ai/product/upgrade/upgrade-timefold.gradle > upgrade-timefold.gradle
gradle -Dorg.gradle.jvmargs=-Xmx2G --init-script upgrade-timefold.gradle rewriteRun -DtimefoldSolverVersion=1.15.0

Environment

Optaplanner 8.30.0.Final:

Output of java -version:

java version "1.8.0_292"
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Corretto-21.0.3.9.1 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.3.9.1 (build 21.0.3+9-LTS, mixed mode, sharing)

Output of uname -a or ver:

Darwin Sunyeols-MacBook-Pro.local 24.0.0 Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:25 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6030 arm64

Additional information

The issue seems to be related to the rewrite() method not being available in the DefaultDependencyHandler class. This might be due to a missing plugin or an incorrect method call in the [upgrade-timefold.gradle] script.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the downloaded upgrade-timefold.gradle script and reproduce the failure using the provided curl and Gradle command. Inspect why rewrite() is invoked on DefaultDependencyHandler and confirm the upgrade script completes rewriteRun successfully with timefoldSolverVersion=1.15.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.