Cannot run in gradle multiproject: Could not find method rewrite() for arguments [org.openrewrite.recipe:rewrite-micronaut:1.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
See original GitHub issueHi there. I try to use micronaut in gradle multiproject. But I get this error:
Build file '/home/fengyu/下载/demo/app/build.gradle' line: 30
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method rewrite() for arguments [org.openrewrite.recipe:rewrite-micronaut:1.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Here is the reproduce steps:
curl --location --request GET 'https://launch.micronaut.io/create/default/com.example.app?lang=JAVA&build=GRADLE&test=SPOCK&javaVersion=JDK_11&features=openrewrite' --output app.zip
mkdir -p demo
unzip -d demo app.zip
echo "include 'app'" > demo/settings.gradle
rm -f demo/app/settings.gradle
cd demo/app
./gradlew rewriteDryRun
Will show error;
* Where:
Build file '/home/fengyu/下载/demo/app/build.gradle' line: 30
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method rewrite() for arguments [org.openrewrite.recipe:rewrite-micronaut:1.3.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
core'] on object of type org.gradle.api.internal.artifacts.dsl ...
As the title says, it is erroring while i try to run the build.gradle file at line 7 dependencies { classpath ...
Read more >Could not find method compile() for arguments Gradle
NOTE: I do have the java, maven, nexus, shadow, and rebel plugins applied. When I run my Gradle task, I encounter this error:...
Read more >Gradle Plugin Configuration - OpenRewrite
With the plugin applied, the rewrite DSL is available for configuration. Multi-Module Gradle Projects.
Read more >Gradle 5 - Grails 3 simple multi-project app/plugin won't compile
grails-plugin'] > Could not find method runtimeOnly() for arguments [io.methvin:directory-watcher] on object of type org.gradle.api.internal.
Read more >Could not find method testCompile() for arguments [{group ...
I now ge the error: Could not find method testCompile() for arguments [{group=junit, name=junit, version=4.12}] on object of type org.gradle.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Great. It’s working now. Thanks.
I experienced the same problem in my own project (coincidentially, also a micronaut project, though I think none of the problems is micronaut-specific), and could also reproduce it by following your steps. I will try to describe a solution.
Step 2 of the Quickstart guide states:
The OpenRewrite Guide does not explain how to do this, but some information can be found in the Gradle guide.
You need to have a
build.gradlefile in your root project (demo/build.gradle):Then you can remove everything rewrite-related from your subproject file
demo/app/build.gradle. Theoretically, you can also keep those lines there, but you need to changeid("org.openrewrite.rewrite") version("5.14.0")to justid("org.openrewrite.rewrite")then, or you will get the error:If you use JDK >= 16, you may now run into #909 which has a workaround.
Also, you need to run your task from the root directory
demo, not fromdemo/app. In your case, gradle wrapper is only presend in theappdirectory, so instead of./gradlew rewriteDryRunyou must usegradle rewriteDryRunor initialize the wrapper in the root as well.To get to this point, I made all the mistakes you made, and many more. I think the documentation should be improved, meaning both the OpenRewrite Quickstart guide and the Micronaut upgrade guide.