Skip to content

Resolve the Gradle plugin from the Code Genome Project - #536

Merged
timtebeek merged 3 commits into
masterfrom
tim/cgp-gradle-docs
Aug 27, 2026
Merged

Resolve the Gradle plugin from the Code Genome Project#536
timtebeek merged 3 commits into
masterfrom
tim/cgp-gradle-docs

Conversation

@timtebeek

@timtebeek timtebeek commented Aug 27, 2026

Copy link
Copy Markdown
Member

This is a live breakage, not just doc residue

Following getting-started.md exactly does not work today. Verified with Gradle 8.14.3:

plugins { id 'org.openrewrite.rewrite' version '7.41.0' }
repositories { mavenCentral() /* + CGP, as the docs currently show */ }
> Could not resolve org.openrewrite:plugin:7.41.0
   > Could not parse POM .../plugin-7.41.0.pom
      > Could not resolve org.openrewrite:rewrite-bom:8.91.0

The marker and the plugin jar are still on the Portal, but org.openrewrite:plugin's runtimeElements declares org.openrewrite:rewrite-bom:8.91.0, and that is 404 on both the Portal's m2 mirror and Maven Central (last version on either is 8.90.4). It resolves on the buildscript classpath, so the project-level repositories block the earlier PRs added does not help.

Confirmed three ways:

  • 7.39.0 (bom 8.89.0, still on Central) → rewriteDiscover succeeds on Portal + mavenCentral() alone.
  • Serving rewrite-bom:8.91.0 from a repository in pluginManagement.repositories gets past the classpath; the only remaining failure is the runtime core-lib resolution that project-level CGP already covers.
  • The init-script path fails identically.

So Gradle needs the Code Genome Project in two places, and this PR adds the missing one everywhere.

What changed

  • src/components/RunRecipe/index.tsx — one edit covering every generated recipe page. Adds a settings.gradle pluginManagement step and a gradle.properties step to the Gradle tab, and moves the init scripts' classpath resolution from plugins.gradle.org/m2 to the Code Genome Project.
  • running-recipes/getting-started.md, reference/gradle-plugin-configuration.mdpluginManagement alongside the existing project repositories, with an explanation of why both are needed.
  • running-rewrite-on-a-gradle-project-without-modifying-the-build.md — Code Genome Project inside initscript { repositories }, Groovy and Kotlin.
  • running-text-based-recipes.md, running-rewrite-on-an-infrastructure-as-code-project.md, authoring-recipes/data-tables.md, popular-recipe-guides/automatically-fix-checkstyle-violations.md, authoring-declarative-yaml-recipes.md — same two-place fix.
  • authoring-recipes/recipe-development-environment.md, recipe-testing.md, refaster-recipes.md, writing-kotlin-recipes.md — recipe-module builds had no repositories block at all for the rewrite modules they compile against.
  • reference/latest-versions-of-every-openrewrite-module.md — drops the claim that the Gradle plugin is published to the Plugin Portal.
  • reference/snapshot-instructions.md — Gradle snapshots now come from the Code Genome Project.
  • reference/building-openrewrite-from-source.md — the isolated-environment allowlist needed a Code Genome Project mirror entry.

Credentials

Gradle snippets now read codeGenomeUsername / codeGenomeToken via providers.gradleProperty(...) instead of inlining USERNAME / TOKEN, with guidance to keep them in ~/.gradle/gradle.properties (or ORG_GRADLE_PROJECT_* env vars in CI).

Init scripts are the exception: they run before any project is configured and cannot read gradle.properties, so those use CODE_GENOME_USERNAME / CODE_GENOME_TOKEN environment variables. Called out inline where it appears.

Assumptions to confirm

  1. Plugin markers on the Code Genome Project. plugins { id("org.openrewrite.rewrite") version "…" } resolving from a plain Maven repository requires the org.openrewrite.rewrite:org.openrewrite.rewrite.gradle.plugin marker POM to be published there alongside org.openrewrite:plugin. I could not verify this — every path under /maven returns 401 whether or not it exists. If markers are not published, these snippets need a resolutionStrategy or a buildscript block instead.
  2. Snapshots live under the same https://artifacts.codegenomeproject.org/maven URL (there is no separate /maven-snapshots or /snapshots endpoint — both 404).
  3. Is rewrite-bom on the plugin's runtimeElements intended? If it gets shaded or dropped upstream, the pluginManagement requirement goes away for the plugin classpath, though it would still be needed once the plugin itself leaves the Portal.

Verification

yarn build with CI_STRICT_LINKS=1 passes locally, and the rendered recipe pages were spot-checked. All Gradle snippets in this PR were syntax-checked by running them through Gradle 8.14.3.

The Gradle plugin is moving off the Gradle Plugin Portal, and its
dependencies are already gone from it: org.openrewrite:plugin 7.40.0 and
7.41.0 declare org.openrewrite:rewrite-bom:8.91.0, which the portal's m2
mirror cannot serve because it is no longer on Maven Central.

Declaring the Code Genome Project in the project's repositories is not
enough, since that is the wrong classpath for plugin resolution. Every
Gradle snippet now declares it in pluginManagement as well, and reads
credentials from gradle.properties rather than inlining them. Init
scripts run before any project is configured and so cannot read
gradle.properties; those use environment variables instead.
# Conflicts:
#	docs/authoring-recipes/recipe-development-environment.md
#	docs/authoring-recipes/recipe-testing.md
#	docs/authoring-recipes/refaster-recipes.md
#	docs/authoring-recipes/writing-kotlin-recipes.md
#	docs/reference/snapshot-instructions.md
#	docs/running-recipes/popular-recipe-guides/authoring-declarative-yaml-recipes.md
@timtebeek
timtebeek marked this pull request as ready for review August 27, 2026 15:04
@timtebeek
timtebeek requested a review from mike-solomon August 27, 2026 15:04

@mike-solomon mike-solomon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this! One minor comment below.

I do recognize that there is a lot of duplicated information throughout this - in the future we may want to investigate a partial that can be plugged in to various pages - but I don't think it's necessary right now.

Comment thread docs/authoring-recipes/data-tables.md
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Aug 27, 2026
@timtebeek
timtebeek merged commit 04362df into master Aug 27, 2026
2 checks passed
@timtebeek
timtebeek deleted the tim/cgp-gradle-docs branch August 27, 2026 16:20
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants