Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AvatarHwang opened this issue Oct 29, 2024 · 4 comments
Labels
bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc.

Comments

@AvatarHwang
Copy link

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.

@AvatarHwang AvatarHwang added bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc. labels Oct 29, 2024
@triceo
Copy link
Contributor

triceo commented Oct 29, 2024

Hello @AvatarHwang, and thanks for reporting!
Can you please share the version of Gradle you were using?

Also, these two versions do not match:

java version "1.8.0_292"
openjdk version "21.0.3" 2024-04-16 LTS

Java 8 is not supported and any failure is possible there. That said, I am not sure how the same command can report both a version 8 (unsupported) and 21 (supported). Please ensure you actually run with Java 17+, and not Java 8.

@AvatarHwang
Copy link
Author

Hello! Thank you for your response.

I would like to clarify my environment:

  • Gradle version: 8.8
  • Please disregard the Java 1.8.0_292 version that was mistakenly included in my report.

Let me know if you need any additional information.

@triceo
Copy link
Contributor

triceo commented Oct 29, 2024

Thank you for clarifying. We have had several similar reports in the past - unfortunately, we were never able to reproduce this locally, and therefore we do not have a fix.

There must be something environment-specific which causes this issue and we do not know what it is. I can only recommend running the migration through Maven, or doing it manually - both are described here:

https://docs.timefold.ai/timefold-solver/latest/upgrading-timefold-solver/upgrade-from-optaplanner

@AvatarHwang
Copy link
Author

Thank you for the alternative suggestions.

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working process/needs triage Requires initial assessment of validity, priority etc.
Projects
None yet
Development

No branches or pull requests

2 participants