openrewrite / rewrite-gradle-plugin

OpenRewrite's Gradle plugin.
Apache License 2.0
64 stars 40 forks source link

No fallback for rewrite version #189

Closed nomisRev closed 1 year ago

nomisRev commented 1 year ago

Currently the rewriteVersion results in null unless adding rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:1.18.0")).

Or should this version somehow be on the classpath through a published recipe jar by including version.properties? Such that adding a rewrite("io:arrow-kt:rewrite-arrow:0.1.0-SNAPSHOT") dependency results in the rewriteVersion to not be null?

That was not entirely clear to me, an alternative could also be to fallback to latest.release as version when rewriteVersion is null.

The same applies to extension.getRewriteKotlinVersion, extension.getRewritePythonVersion & extension.getRewriteGradleModelVersion. I'm also not entirely sure how extension.getJacksonModuleKotlinVersion gets resolved though 🤔

shanman190 commented 1 year ago

So the way that this is supposed to work is that we have a rewriteDependencies configuration in the plugin build to resolve the specific versions into the jar file under /rewrite/version.properties.

https://github.com/openrewrite/rewrite-gradle-plugin/blob/f881a23f3339e12c5db16d8446de12167642038a/plugin/build.gradle.kts#L98-L118 https://github.com/openrewrite/rewrite-gradle-plugin/blob/f881a23f3339e12c5db16d8446de12167642038a/plugin/build.gradle.kts#L161-L186

From here, the plugin loads these versions of the classpath to set the default values for each of the extension properties here: https://github.com/openrewrite/rewrite-gradle-plugin/blob/f881a23f3339e12c5db16d8446de12167642038a/plugin/src/main/java/org/openrewrite/gradle/RewriteExtension.java#L178-L188

You'll notice that each of the version methods grabs the version out of this file.

shanman190 commented 1 year ago

This should mean that even your PR shouldn't have failed in the first place because a version is provided for the checkstyle dependency. https://github.com/openrewrite/rewrite-gradle-plugin/pull/188

If I were to wager a guess, I'm guessing that there is another jar on Gradle's classpath with a rewrite/version.properties that is getting loaded instead and doesn't contain the necessary information...

nomisRev commented 1 year ago

Okay, thank you for clarifying how that works. Now it makes sense that I didn't see a version.propreties file in the project but it's present in the Jar nevertheless. I remember that I also once used this trick once myself.

However, something seems to be off.

If I were to wager a guess, I'm guessing that there is another jar on Gradle's classpath with a rewrite/version.properties that is getting loaded instead and doesn't contain the necessary information...

I really doubt that actually, but I can try reproducing this on an empty project. The project I was attempting to this this on, https://github.com/nomisRev/ktor-arrow-example/pull/132/files. It's a Kotlin project with pretty simple dependency list.

Execution failed for task ':rewriteResolveDependencies'.
> Could not resolve all dependencies for configuration ':detachedConfiguration5'.
  The project declares repositories, effectively ignoring the repositories you have declared in the settings.
  You can figure out how project repositories are declared by configuring your build to fail on project repositories.
  See https://docs.gradle.org/8.0.2/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories for details.
   > Could not find com.puppycrawl.tools:checkstyle:null.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/puppycrawl/tools/checkstyle/null/checkstyle-null.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :

I'll report back if I was able to reproduce it on an empty project.

nomisRev commented 1 year ago

@shanman190 in an empty project it does work.

If I were to wager a guess, I'm guessing that there is another jar on Gradle's classpath with a rewrite/version.properties that is getting loaded instead and doesn't contain the necessary information...

So this might be possible... although not sure how to debug that. However, is it desired in the case that it fails like this?

Edit:

This is the buildEnviroment

+--- io.kotest.multiplatform:io.kotest.multiplatform.gradle.plugin:5.5.5
|    \--- io.kotest:kotest-framework-multiplatform-plugin-gradle:5.5.5
|         \--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21 -> 1.8.20
|              +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.8.20
|              |    |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.20 (c)
|              |    |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20 (c)
|              |    |    +--- org.jetbrains.kotlin:kotlin-serialization:1.8.20 (c)
|              |    |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.8.20 (c)
|              |    |    +--- org.jetbrains.kotlin:kotlin-native-utils:1.8.20 (c)
|              |    |    +--- org.jetbrains.kotlin:kotlin-tooling-core:1.8.20 (c)
|              |    |    \--- org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.8.20 (c)
|              |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-native-utils:1.8.20
|              |    |    \--- org.jetbrains.kotlin:kotlin-util-io:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-project-model:1.8.20
|              |    |    \--- org.jetbrains.kotlin:kotlin-tooling-core:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-tooling-core:1.8.20
|              +--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.20 (*)
|              |    \--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-tooling-core:1.8.20
|              +--- org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-tooling-core:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.8.20
|              +--- org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-util-klib:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-util-io:1.8.20
|              +--- org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-native-utils:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-project-model:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.8.20
|              |    +--- org.jetbrains.intellij.deps:trove4j:1.0.20200330
|              |    \--- net.java.dev.jna:jna:5.6.0 -> 5.13.0
|              +--- org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-android-extensions:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-compiler-runner:1.8.20
|              |    +--- org.jetbrains.kotlin:kotlin-daemon-client:1.8.20
|              |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0 -> 1.6.3
|              |    |         \--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.6.3
|              |    |              +--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.3 (c)
|              |    |              \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3 (c)
|              |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0 -> 1.6.3 (*)
|              |    \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.8.20 (*)
|              +--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.8.20
|              |    \--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.8.20
|              |         +--- org.jetbrains.kotlin:kotlin-scripting-common:1.8.20
|              |         \--- org.jetbrains.kotlin:kotlin-scripting-jvm:1.8.20
|              |              \--- org.jetbrains.kotlin:kotlin-scripting-common:1.8.20
|              \--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.8.20 (*)
+--- org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin:1.8.10
|    \--- org.jetbrains.dokka:dokka-gradle-plugin:1.8.10
|         \--- org.jetbrains.dokka:dokka-core:1.8.10
|              +--- org.jsoup:jsoup:1.15.3
|              +--- com.fasterxml.jackson.module:jackson-module-kotlin:2.12.7 -> 2.13.2
|              |    +--- com.fasterxml.jackson.core:jackson-databind:2.13.2 -> 2.13.2.2
|              |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.13.2
|              |    |    |    \--- com.fasterxml.jackson:jackson-bom:2.13.2
|              |    |    |         +--- com.fasterxml.jackson.core:jackson-annotations:2.13.2 (c)
|              |    |    |         +--- com.fasterxml.jackson.core:jackson-core:2.13.2 (c)
|              |    |    |         +--- com.fasterxml.jackson.core:jackson-databind:2.13.2 -> 2.13.2.2 (c)
|              |    |    |         +--- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.2 (c)
|              |    |    |         +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2 (c)
|              |    |    |         \--- com.fasterxml.jackson.module:jackson-module-kotlin:2.13.2 (c)
|              |    |    +--- com.fasterxml.jackson.core:jackson-core:2.13.2
|              |    |    |    \--- com.fasterxml.jackson:jackson-bom:2.13.2 (*)
|              |    |    \--- com.fasterxml.jackson:jackson-bom:2.13.2 (*)
|              |    +--- com.fasterxml.jackson.core:jackson-annotations:2.13.2 (*)
|              |    \--- com.fasterxml.jackson:jackson-bom:2.13.2 (*)
|              +--- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.12.7 -> 2.13.2
|              |    +--- com.fasterxml.jackson.core:jackson-core:2.13.2 (*)
|              |    +--- com.fasterxml.jackson.core:jackson-annotations:2.13.2 (*)
|              |    +--- com.fasterxml.jackson.core:jackson-databind:2.13.2 -> 2.13.2.2 (*)
|              |    +--- org.codehaus.woodstox:stax2-api:4.2.1
|              |    +--- com.fasterxml.woodstox:woodstox-core:6.2.7
|              |    |    \--- org.codehaus.woodstox:stax2-api:4.2.1
|              |    \--- com.fasterxml.jackson:jackson-bom:2.13.2 (*)
|              +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3
|              |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.3 (*)
|              +--- org.jetbrains:markdown:0.3.1
|              |    \--- org.jetbrains:markdown-jvm:0.3.1
|              \--- com.fasterxml.jackson.core:jackson-databind:2.12.7.1 -> 2.13.2.2 (c)
+--- org.jetbrains.kotlinx.kover:org.jetbrains.kotlinx.kover.gradle.plugin:0.6.1
|    \--- org.jetbrains.kotlinx:kover:0.6.1
+--- org.jetbrains.kotlin.plugin.serialization:org.jetbrains.kotlin.plugin.serialization.gradle.plugin:1.8.20
|    \--- org.jetbrains.kotlin:kotlin-serialization:1.8.20
|         +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.20 (*)
|         \--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.8.20 (*)
+--- app.cash.sqldelight:app.cash.sqldelight.gradle.plugin:2.0.0-alpha05
|    \--- app.cash.sqldelight:gradle-plugin:2.0.0-alpha05
|         +--- org.xerial:sqlite-jdbc:3.40.0.0
|         +--- de.danielbechler:java-object-diff:0.95
|         |    \--- org.slf4j:slf4j-api:1.7.22
|         +--- us.fatehi:schemacrawler-tools:16.19.2
|         |    \--- us.fatehi:schemacrawler-api:16.19.2
|         |         \--- us.fatehi:schemacrawler-utility:16.19.2
|         +--- us.fatehi:schemacrawler-sqlite:16.19.2
|         |    +--- us.fatehi:schemacrawler:16.19.2
|         |    \--- org.xerial:sqlite-jdbc:3.39.4.1 -> 3.40.0.0
|         +--- app.cash.sqldelight:migrations:2.0.0-alpha05
|         |    +--- com.alecstrong.sql.psi:core:0.4.2
|         |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21 -> 1.8.10
|         |    |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10
|         |    |         |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.8.10
|         |    |         |    \--- org.jetbrains:annotations:13.0
|         |    |         \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10
|         |    |              \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 (*)
|         |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.8.10 (*)
|         +--- app.cash.sqldelight:core:2.0.0-alpha05
|         |    +--- com.squareup:kotlinpoet:1.12.0
|         |    |    +--- org.jetbrains.kotlin:kotlin-reflect:1.7.0 -> 1.8.10
|         |    |    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 (*)
|         |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.0 -> 1.8.10 (*)
|         |    +--- org.jgrapht:jgrapht-core:1.5.1
|         |    |    \--- org.jheaps:jheaps:0.13
|         |    +--- com.alecstrong.sql.psi:core:0.4.2 (*)
|         |    +--- app.cash.sqldelight:dialect-api:2.0.0-alpha05
|         |    |    +--- com.alecstrong.sql.psi:core:0.4.2 (*)
|         |    |    +--- com.squareup:kotlinpoet:1.12.0 (*)
|         |    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.8.10 (*)
|         |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.8.10 (*)
|         +--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0 -> 1.8.20 (*)
|         +--- net.java.dev.jna:jna:5.13.0
|         \--- com.alecstrong.sql.psi:core:0.4.2 (*)
+--- io.ktor.plugin:io.ktor.plugin.gradle.plugin:2.2.4
|    \--- io.ktor.plugin:plugin:2.2.4
|         +--- com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:7.1.2
|         |    \--- gradle.plugin.com.github.johnrengelman:shadow:7.1.2
|         |         +--- org.jdom:jdom2:2.0.6
|         |         +--- org.ow2.asm:asm:9.2
|         |         +--- org.ow2.asm:asm-commons:9.2
|         |         |    +--- org.ow2.asm:asm:9.2
|         |         |    +--- org.ow2.asm:asm-tree:9.2
|         |         |    |    \--- org.ow2.asm:asm:9.2
|         |         |    \--- org.ow2.asm:asm-analysis:9.2
|         |         |         \--- org.ow2.asm:asm-tree:9.2 (*)
|         |         +--- commons-io:commons-io:2.11.0
|         |         +--- org.apache.ant:ant:1.10.11
|         |         |    \--- org.apache.ant:ant-launcher:1.10.11
|         |         +--- org.codehaus.plexus:plexus-utils:3.4.1
|         |         +--- org.apache.logging.log4j:log4j-core:2.17.1
|         |         |    \--- org.apache.logging.log4j:log4j-api:2.17.1
|         |         \--- org.vafer:jdependency:2.7.0
|         +--- gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.2.1
|         |    +--- com.google.http-client:google-http-client:1.34.0
|         |    |    +--- org.apache.httpcomponents:httpclient:4.5.10
|         |    |    |    +--- org.apache.httpcomponents:httpcore:4.4.12
|         |    |    |    +--- commons-logging:commons-logging:1.2
|         |    |    |    \--- commons-codec:commons-codec:1.11
|         |    |    +--- org.apache.httpcomponents:httpcore:4.4.12
|         |    |    +--- com.google.code.findbugs:jsr305:3.0.2
|         |    |    +--- com.google.guava:guava:28.1-android -> 31.1-jre
|         |    |    |    +--- com.google.guava:failureaccess:1.0.1
|         |    |    |    +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|         |    |    |    +--- com.google.code.findbugs:jsr305:3.0.2
|         |    |    |    +--- org.checkerframework:checker-qual:3.12.0
|         |    |    |    +--- com.google.errorprone:error_prone_annotations:2.11.0
|         |    |    |    \--- com.google.j2objc:j2objc-annotations:1.3
|         |    |    +--- com.google.j2objc:j2objc-annotations:1.3
|         |    |    +--- io.opencensus:opencensus-api:0.24.0
|         |    |    |    \--- io.grpc:grpc-context:1.22.1
|         |    |    \--- io.opencensus:opencensus-contrib-http-util:0.24.0
|         |    |         +--- io.opencensus:opencensus-api:0.24.0 (*)
|         |    |         \--- com.google.guava:guava:26.0-android -> 31.1-jre (*)
|         |    +--- com.google.http-client:google-http-client-apache-v2:1.34.0
|         |    |    +--- com.google.http-client:google-http-client:1.34.0 (*)
|         |    |    +--- org.apache.httpcomponents:httpclient:4.5.10 (*)
|         |    |    \--- org.apache.httpcomponents:httpcore:4.4.12
|         |    +--- com.google.auth:google-auth-library-oauth2-http:0.18.0
|         |    |    +--- com.google.auto.value:auto-value-annotations:1.6.6
|         |    |    +--- com.google.code.findbugs:jsr305:3.0.2
|         |    |    +--- com.google.auth:google-auth-library-credentials:0.18.0
|         |    |    +--- com.google.http-client:google-http-client:1.32.1 -> 1.34.0 (*)
|         |    |    +--- com.google.http-client:google-http-client-jackson2:1.32.1
|         |    |    |    +--- com.google.http-client:google-http-client:1.32.1 -> 1.34.0 (*)
|         |    |    |    \--- com.fasterxml.jackson.core:jackson-core:2.9.9 -> 2.13.2 (*)
|         |    |    \--- com.google.guava:guava:28.1-android -> 31.1-jre (*)
|         |    +--- org.apache.commons:commons-compress:1.21
|         |    +--- com.google.guava:guava:31.1-jre (*)
|         |    +--- com.fasterxml.jackson.core:jackson-databind:2.13.2.2 (*)
|         |    +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2
|         |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.13.2 (*)
|         |    |    +--- com.fasterxml.jackson.core:jackson-core:2.13.2 (*)
|         |    |    +--- com.fasterxml.jackson.core:jackson-databind:2.13.2 -> 2.13.2.2 (*)
|         |    |    \--- com.fasterxml.jackson:jackson-bom:2.13.2 (*)
|         |    +--- org.ow2.asm:asm:9.2
|         |    +--- com.google.cloud.tools:jib-build-plan:0.4.0
|         |    +--- com.google.cloud.tools:jib-plugins-extension-common:0.2.0
|         |    \--- com.google.cloud.tools:jib-gradle-plugin-extension-api:0.4.0
|         |         +--- com.google.cloud.tools:jib-build-plan:0.4.0
|         |         \--- com.google.cloud.tools:jib-plugins-extension-common:0.2.0
|         +--- org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.9.12
|         |    \--- org.graalvm.buildtools:native-gradle-plugin:0.9.12
|         |         +--- org.graalvm.buildtools:utils:0.9.12
|         |         |    \--- com.fasterxml.jackson.core:jackson-databind:2.12.4 -> 2.13.2.2 (*)
|         |         \--- org.graalvm.buildtools:jvm-reachability-metadata:0.9.12
|         |              \--- com.fasterxml.jackson.core:jackson-databind:2.12.4 -> 2.13.2.2 (*)
|         \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21 -> 1.8.10 (*)
+--- org.openrewrite.rewrite:org.openrewrite.rewrite.gradle.plugin:5.39.0
|    \--- org.openrewrite:plugin:5.39.0
|         +--- org.openrewrite:rewrite-bom:7.39.1
|         \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.8.10 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:{strictly 1.8.10} -> 1.8.10 (c)
+--- org.jetbrains.kotlin:kotlin-stdlib:{strictly 1.8.10} -> 1.8.10 (c)
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:{strictly 1.8.10} -> 1.8.10 (c)
+--- org.jetbrains.kotlin:kotlin-reflect:{strictly 1.8.10} -> 1.8.10 (c)
+--- org.apache.logging.log4j:log4j-core:{require 2.17.1; reject [2.0, 2.17.1)} -> 2.17.1 (c)
+--- org.jetbrains.kotlin:kotlin-stdlib-common:{strictly 1.8.10} -> 1.8.10 (c)
\--- org.jetbrains:annotations:{strictly 13.0} -> 13.0 (c)
madorb commented 1 year ago

i'm running into similar issue on another project ... though i do have the bom in place.

plugins {
    id("java-library")
    id("org.openrewrite.rewrite") version "5.39.0"
}

dependencies {
    rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:1.18.0"))
    rewrite("org.openrewrite.recipe:rewrite-spring")
}

rewrite {
    activeRecipe("org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_0")
}
Execution failed for task ':rewriteResolveDependencies'.
> Could not resolve all files for configuration ':detachedConfiguration3'.
   > Could not find com.puppycrawl.tools:checkstyle:null.
     Searched in the following locations:
       - https://<myartifactory>/artifactory/private/com/puppycrawl/tools/checkstyle/null/checkstyle-null.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.

with info on i see:

> Task :rewriteResolveDependencies
Caching disabled for task ':rewriteResolveDependencies' because:
  Caching has not been enabled for the task
Task ':rewriteResolveDependencies' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
The configuration :detachedConfiguration5 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these.
The configuration :detachedConfiguration5 is both consumable and declarable. This combination is incorrect, only one of these flags should be set.
The configuration :detachedConfiguration5 is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these.
The configuration :detachedConfiguration5 is both consumable and declarable. This combination is incorrect, only one of these flags should be set.
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-core/null/rewrite-core-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-groovy/null/rewrite-groovy-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-gradle/null/rewrite-gradle-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-hcl/null/rewrite-hcl-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-json/null/rewrite-json-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-kotlin/null/rewrite-kotlin-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-python/null/rewrite-python-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-java/null/rewrite-java-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-java-17/null/rewrite-java-17-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-java-11/null/rewrite-java-11-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-java-8/null/rewrite-java-8-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-maven/null/rewrite-maven-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-properties/null/rewrite-properties-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-protobuf/null/rewrite-protobuf-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-xml/null/rewrite-xml-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/rewrite-yaml/null/rewrite-yaml-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/org/openrewrite/gradle/tooling/model/null/model-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/com/puppycrawl/tools/checkstyle/null/checkstyle-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/com/fasterxml/jackson/module/jackson-module-kotlin/null/jackson-module-kotlin-null.pom]
Resource missing. [HTTP GET: <myartifactory>/artifactory/private/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/null/jackson-datatype-jsr310-null.pom]
madorb commented 1 year ago

@nomisRev do you happen to be using detekt

I just realized that if i have:

plugins {
    id("java-library")
    id("io.gitlab.arturbosch.detekt") version "1.21.0"
    id("org.openrewrite.rewrite") version "5.39.0"
}

then detekt will work, but openrewrite will not, but if i reverse the declaration order between those two - both will work.

nomisRev commented 1 year ago

I do but changing the order doesn't seem to affect my project, I have multiple other plugins though.

Screenshot 2023-04-05 at 21 09 54
nomisRev commented 1 year ago

Oh wait.. detekt is already being applied in buildSrc in my case :/

shanman190 commented 1 year ago

Ok, so it appears that I misspoke earlier slightly. Presently the plugin writes the versions.properties to the root of the jar. This is obviously conflicting with other versions.properties from other jars. We're working on getting a patch in to move the file to rewrite/versions.properties, then will do a patch release.

nomisRev commented 1 year ago

@madorb disabling detekt does affect it, and solve the issue.

@shanman190, so it seems this is not related but it seems a recipe jar I am trying to depend on is being mangled and cannot be found. Any idea what might cause this? Should I create a separate issue?

Execution failed for task ':rewriteResolveDependencies'.
> Could not resolve all dependencies for configuration ':detachedConfiguration5'.
  The project declares repositories, effectively ignoring the repositories you have declared in the settings.
  You can figure out how project repositories are declared by configuring your build to fail on project repositories.
  See https://docs.gradle.org/8.0.2/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories for details.
   > Could not find io:arrow-kt:rewrite-arrow.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/io/arrow-kt/rewrite-arrow/arrow-kt-rewrite-arrow.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :

This is for:

rewrite("io:arrow-kt:rewrite-arrow:0.1.0-RC")

Which is available at https://repo.maven.apache.org/maven2/io/arrow-kt/rewrite-arrow/1.0.0-RC2/

nomisRev commented 1 year ago

Just to confirm @madorb and @shanman190. This was the issue, detekt also has versions.properties in the root.

https://github.com/detekt/detekt/blob/2cc03a32b169e0b90236d2246b497c60d195a23d/detekt-gradle-plugin/build.gradle.kts#L133

shanman190 commented 1 year ago

@nomisRev, is that dependency coordinate valid in your build.gradle.kts valid?

From a Gradle standpoint, I would have expected the first colon io:arrow-kt to have been a dot io.arrow-kt.

As a result presently, Gradle is thinking that the third portion rewrite-arrow is the version and the fourth portion 0.1.0-RC is a classifier. At least according to string dependency notation.

ie:

group = io
artifact = arrow-kt
version = rewrite-arrow
classifier = 0.1.0-RC
madorb commented 1 year ago

FYI - i've created a ticket with detekt as well, as it seems like best practice would be for neither project to place the file in the root. https://github.com/detekt/detekt/issues/5968

shanman190 commented 1 year ago

So I'm running your sample using a local build of https://github.com/openrewrite/rewrite-gradle-plugin/commit/4170f849cb7cc038a50e6b5fc7a42cc25fd4702c.

After updating your rewrite dependency like so:

rewrite("io.arrow-kt:rewrite-arrow:1.0.0-RC")

The project is now running through correctly.

shanman190 commented 1 year ago

rewrite-gradle-plugin 5.39.1 is now available.

shanman190 commented 1 year ago

@madorb or @nomisRev can you all try out the new release?

madorb commented 1 year ago

looks good to me!