Closed Sanskarbajaj closed 7 months ago
The recipes connect to Maven Central to download updated dependencies and plugins. Here it seems Maven Central is not accessible from your machine, unrelated to OpenRewrite. Might you have some company network policies that get in the way? Also welcome to ask questions via Slack, or Stack overflow, as those are more geared towards questions.
other recipies also i'm trying those working well like junit4 to 5 and all
Are you saying that other recipes work just fine, and it's just the upgrade to Spring Boot 2.7 recipe that fails for you?
Does it repeatedly fail? Since I can access https://repo.maven.apache.org
just fine here. How's that for you?
yes other recipies work fine this didn't work not even one time for me maybe something i'm doing wrong and get the error i pasted earlier and yes i can access the link you sent
So there are two parts here, I think.
UnknownHostException means that the address was not able to be resolved with DNS from your location. @Sanskarbajaj, are you running from some location where Maven Central is or was inaccessible from your device/location? Maybe on an enterprise network that explicitly disallows network access to Maven Central (repo.maven.apache.org)?
There was a bug in UpgradePluginVersion if you have multiple of the same Gradle project files within the workspace. https://github.com/openrewrite/rewrite/commit/adb74acabfe9473864acfc2225019cfb84ac0056 (note that this does not explain the DNS failure to resolve the address from Part 1, that part is a device+location issue outside of scope for us).
i think its the second issue that you mentioned how to fix this any idea? @shanman190 @timtebeek
@Sanskarbajaj, from just your stack trace alone the issue that you're presently facing is the first one for sure. Specifically the java.net.UnknownHostException
is only thrown when the specified DNS address cannot be resolved.
The second one only appears -- and furthermore it appears as an instance of org.openrewrite.maven.MavenDownloadingException
-- if you have multiple build.gradle
files with different repositories across them. It would specifically present as being unable to resolve a specific dependency because it is unavailable in any of the set of used repositories. The bug in particular originates from finding and then reusing the first GradleProject marker that was found across the entire project rather than the one specific to the current build.gradle
file that was being visited. The fix for this will be available in the next rewrite and rewrite-gradle-plugin releases.
Execution failed for task ':rewriteRun'.
java.lang.RuntimeException: Error while visiting clients\build.gradle: java.lang.RuntimeException: java.io.UncheckedIOException: java.net.UnknownHostException: repo.maven.apache.org org.openrewrite.maven.internal.MavenPomDownloader.requestAsAuthenticatedOrAnonymous(MavenPomDownloader.java:808) org.openrewrite.maven.internal.MavenPomDownloader.downloadMetadata(MavenPomDownloader.java:255) org.openrewrite.maven.internal.MavenPomDownloader.downloadMetadata(MavenPomDownloader.java:211) org.openrewrite.gradle.plugins.AddPluginVisitor.downloadMetadata(AddPluginVisitor.java:95) org.openrewrite.gradle.plugins.AddPluginVisitor.findNewerVersion(AddPluginVisitor.java:85) org.openrewrite.gradle.plugins.AddPluginVisitor.resolvePluginVersion(AddPluginVisitor.java:77) org.openrewrite.gradle.plugins.UpgradePluginVersion$3.visitMethodInvocation(UpgradePluginVersion.java:257) org.openrewrite.gradle.plugins.UpgradePluginVersion$3.visitMethodInvocation(UpgradePluginVersion.java:206) org.openrewrite.java.tree.J$MethodInvocation.acceptJava(J.java:3932) org.openrewrite.java.tree.J.accept(J.java:59) org.openrewrite.TreeVisitor.visit(TreeVisitor.java:278) org.openrewrite.TreeVisitor.visitAndCast(TreeVisitor.java:361) org.openrewrite.java.JavaVisitor.visitRightPadded(JavaVisitor.java:1375) org.openrewrite.java.JavaVisitor.lambda$visitBlock$4(JavaVisitor.java:401) org.openrewrite.internal.ListUtils.map(ListUtils.java:176) org.openrewrite.java.JavaVisitor.visitBlock(JavaVisitor.java:400)
the error im getting also related to upgradepluginversion only right? i've made it bold could you please check @shanman190 @timtebeek
and other recipies like move from java 8 to 17 junit 4 to 5 and all are working so its not related to proxy or its not able to access any particular DNS address
Just letting you know that 8.16.0 was released a few days ago, so the fix for the secondary issues of the Gradle recipes also trying Maven Central and incorrectly using the first project's repositories was contained within that release.
What's the latest version of gradle plugin? @shanman190 For the moment I'm using 6.8.2 I couldn't find any latest version in docs could you please help
The latest version is still 6.8.2, and can always be found here: https://github.com/openrewrite/rewrite-gradle-plugin/releases
We'll follow up with a matching Gradle plugin release soon such that you can try out the above 8.16.0 release.
What went wrong: Execution failed for task ':rewriteRun'.
org.openrewrite.RecipeException: Recipes not found:
could you help in this when i'm writing my rewrite.yaml file i give some other name to the recipie
and running command with -Drewrite.configLocation="$PWD/rewrite.yml" its not picking it up any idea ? @shanman190 @timtebeek
The -Drewrite.configLocation=
path should not be absolute, but relative to your project root. If it's ./rewrite.yml
there's no need to pass in any -Drewrite.configLocation
explicitly.
The
-Drewrite.configLocation=
path should not be absolute, but relative to your project root. If it's./rewrite.yml
there's no need to pass in any-Drewrite.configLocation
explicitly.
yeah the path is ./rewrite.yml but its not taking . even tried without passing -Drewrite.configLocation
To start of with here is the published guide for running a Gradle build without modifying the Gradle build. https://docs.openrewrite.org/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build
In that setup there are 3 important things to note:
rewrite.yml
is the project directory of the root project. You should very rarely if ever need to use the configLocation property to move the file.rewrite
configuration of the dependencies block, you need to make sure that all of the recipe libraries that you desire to use or at least the parent are there. The example uses rewrite-spring
and already includes the necessary dependencies.rewrite.yml
file, the name attribute of your declarative recipe MUST be different and must be the value that you pass in as the active recipe.:rewriteRun (Thread[Execution worker for ':',5,main]) started.
Task :rewriteRun Caching disabled for task ':rewriteRun' because: Build cache is disabled Task ':rewriteRun' is not up-to-date because: Task has not declared any outputs despite executing actions.
Task :rewriteRun FAILED :rewriteRun (Thread[Execution worker for ':',5,main]) completed. Took 8.092 secs.
FAILURE: Build failed with an exception.
org.openrewrite.RecipeException: Recipes not found:
this is what i'm getting i've tried putting rewrite.yml in root directory in src directory but its not picking it up
please help @shanman190 @timtebeek
What went wrong: Execution failed for task ':rewriteRun'.