From be605ce42433a542129864eb295cf317f45478cd Mon Sep 17 00:00:00 2001 From: Mike Solomon Date: Tue, 28 Jul 2026 09:32:09 -0700 Subject: [PATCH 1/2] Maven Central -> Code Genome Project --- docs/authoring-recipes/data-tables.md | 11 +++ .../recipe-development-environment.md | 9 +++ docs/reference/faq.md | 2 +- docs/reference/gradle-plugin-configuration.md | 38 +++++++++- docs/reference/snapshot-instructions.md | 4 +- docs/running-recipes/getting-started.md | 55 +++++++++++++- ...automatically-fix-checkstyle-violations.md | 34 ++++++++- ...dle-project-without-modifying-the-build.md | 20 ++++++ ...te-on-an-infrastructure-as-code-project.md | 9 +++ .../running-text-based-recipes.md | 11 +++ src/components/RunRecipe/index.tsx | 72 ++++++++++++++++++- 11 files changed, 252 insertions(+), 13 deletions(-) diff --git a/docs/authoring-recipes/data-tables.md b/docs/authoring-recipes/data-tables.md index e4da8cb39d..690fa46358 100644 --- a/docs/authoring-recipes/data-tables.md +++ b/docs/authoring-recipes/data-tables.md @@ -273,6 +273,10 @@ By default, OpenRewrite recipes will **not** produce a data table. In order for - [rewrite-gradle-plugin](https://github.com/openrewrite/rewrite-gradle-plugin/) version `6.16.5` or higher. 2. Next, you will either need to update build file or modify your command for running a recipe: +:::info +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the Gradle snippet below, replace `USERNAME` and `TOKEN` with your own credentials. See the [quickstart guide](../running-recipes/getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token and on configuring the repository and credentials for Maven. +::: + @@ -290,6 +294,13 @@ rewrite { repositories { mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { diff --git a/docs/authoring-recipes/recipe-development-environment.md b/docs/authoring-recipes/recipe-development-environment.md index 3715a4cf72..7eeefb002d 100644 --- a/docs/authoring-recipes/recipe-development-environment.md +++ b/docs/authoring-recipes/recipe-development-environment.md @@ -377,6 +377,15 @@ plugins { repositories { mavenLocal() mavenCentral() + // The rewrite core libraries are distributed through the Code Genome Project. + // Use the email or username you signed in with, plus a download token as the password. + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { diff --git a/docs/reference/faq.md b/docs/reference/faq.md index fcf9b7eeb0..67c20ffcd1 100644 --- a/docs/reference/faq.md +++ b/docs/reference/faq.md @@ -14,7 +14,7 @@ import TabItem from '@theme/TabItem'; ## Does OpenRewrite collect any data from our projects? -**No**. The [rewrite-maven-plugin](https://github.com/openrewrite/rewrite-maven-plugin) and [rewrite-gradle-plugin](https://github.com/openrewrite/rewrite-gradle-plugin) run locally on your machine, without any connections to Moderne or OpenRewrite. The plugin calls out to Maven Central (or a locally configured mirror) to check for new dependencies. Other than that, you should not see any other outbound traffic. +**No**. The [rewrite-maven-plugin](https://github.com/openrewrite/rewrite-maven-plugin) and [rewrite-gradle-plugin](https://github.com/openrewrite/rewrite-gradle-plugin) run locally on your machine, without any connections to Moderne or OpenRewrite. The plugin calls out to the artifact repositories configured in your build (such as the Code Genome Project or a locally configured mirror) to check for new dependencies. Other than that, you should not see any other outbound traffic. ## What is the difference between OpenRewrite and Moderne? diff --git a/docs/reference/gradle-plugin-configuration.md b/docs/reference/gradle-plugin-configuration.md index acd157ca88..05fd7e5566 100644 --- a/docs/reference/gradle-plugin-configuration.md +++ b/docs/reference/gradle-plugin-configuration.md @@ -22,21 +22,39 @@ rewrite { // Ensure a repository is declared that the rewrite core libraries can be resolved from repositories { - mavenCentral() + mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } ``` +:::info +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. Sign in to the Code Genome Project to create a download token, then replace `USERNAME` with the email or username you signed in with and `TOKEN` with that token. See the [quickstart guide](../running-recipes/getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details. +::: + With the plugin applied, the `rewrite` DSL is available for configuration. ### Multi-module Gradle projects When applied to a multi-project build, plugin behavior differs depending on whether the plugin is applied to the root project or to a sub-project. Applied to the root project, the plugin will parse and refactor all sources from all projects. Applied to any project other than the root project, the plugin will parse and refactor only sources from that project. -The rewrite Gradle plugin resolves the rewrite core libraries and any recipe modules added to the `rewrite` configuration at runtime. It will attempt to resolve them from whatever repositories are available to the project. This is accomplished by adding Maven Central, or a mirror of it, to your project's repositories: +The rewrite Gradle plugin resolves the rewrite core libraries and any recipe modules added to the `rewrite` configuration at runtime. It will attempt to resolve them from whatever repositories are available to the project. This is accomplished by adding the Code Genome Project repository, or an internal repository that mirrors it, to your project's repositories: ```groovy repositories { mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } ``` @@ -73,6 +91,13 @@ plugins { repositories { mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } rewrite { @@ -97,7 +122,7 @@ rewrite { ## Activating OpenRewrite recipes :::info -All OpenRewrite libraries and modules are published to MavenCentral. Use the `repositories` Gradle DSL to ensure that your build can resolve dependencies from there or one of its mirrors. +OpenRewrite libraries and modules are published to the Code Genome Project. Use the `repositories` Gradle DSL to ensure that your build can resolve dependencies from there, or from an internal repository that mirrors it. ::: No recipe is ever run on your codebase without being explicitly activated in the plugin's configuration. To make pre-packaged OpenRewrite recipes available for activation, add Rewrite's bill of materials along with the specific `rewrite` dependencies: @@ -119,6 +144,13 @@ plugins { repositories { mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { diff --git a/docs/reference/snapshot-instructions.md b/docs/reference/snapshot-instructions.md index 2d676328e4..7ae1f58fda 100644 --- a/docs/reference/snapshot-instructions.md +++ b/docs/reference/snapshot-instructions.md @@ -85,8 +85,8 @@ To utilize snapshot versions in Maven projects, you'll need to make the followin ``` * You can look up the latest released versions via - - [Latest rewrite-maven-plugin version](https://central.sonatype.com/artifact/org.openrewrite.maven/rewrite-maven-plugin/versions) - - [Latest rewrite recipe module versions](https://central.sonatype.com/namespace/org.openrewrite.recipe) + - [Latest rewrite-maven-plugin version](https://artifacts.codegenomeproject.org/maven/org/openrewrite/maven/rewrite-maven-plugin/) + - [Latest rewrite recipe module versions](https://artifacts.codegenomeproject.org/maven/org/openrewrite/recipe/) ## Maven Command Line instructions diff --git a/docs/running-recipes/getting-started.md b/docs/running-recipes/getting-started.md index 2833b59fb9..ef85b0bfc9 100644 --- a/docs/running-recipes/getting-started.md +++ b/docs/running-recipes/getting-started.md @@ -49,12 +49,16 @@ git clone https://github.com/openrewrite/spring-petclinic-migration.git ## Step 2: Add rewrite-maven-plugin or rewrite-gradle-plugin to your project -Once you've checked out your project, the next step is to add the OpenRewrite plugin to Maven or Gradle. Please follow the instructions in the Maven or Gradle tab to do that: +Once you've checked out your project, the next step is to add the OpenRewrite plugin to Maven or Gradle. + +OpenRewrite artifacts are distributed through the Code Genome Project repository (`https://artifacts.codegenomeproject.org/maven`), which requires authentication. To get access, sign in to the Code Genome Project and create a download token. Your build then authenticates with the email or username you signed in with, plus that token as the password. The snippets below use `USERNAME` and `TOKEN` as placeholders for these credentials. + +Please follow the instructions in the Maven or Gradle tab to configure your project: * Add the OpenRewrite plugin to the `plugins` section of your `build.gradle` file - * Make sure `mavenCentral()` is included in the `repositories` section + * Add the Code Genome Project repository to the `repositories` section (keep `mavenCentral()` there for your project's other dependencies) * Add a `rewrite` section that will be filled in later Your file should look similar to: @@ -70,6 +74,13 @@ Once you've checked out your project, the next step is to add the OpenRewrite pl // The root project doesn't have to be a Java project, but this is necessary // to resolve recipe artifacts. mavenCentral() + maven { + url = 'https://artifacts.codegenomeproject.org/maven' + credentials { + username = 'USERNAME' + password = 'TOKEN' + } + } } rewrite { @@ -81,7 +92,7 @@ Once you've checked out your project, the next step is to add the OpenRewrite pl * Add the OpenRewrite plugin to the `plugins` section of your `build.gradle.kts` file - * Make sure `mavenCentral()` is included in the `repositories` section + * Add the Code Genome Project repository to the `repositories` section (keep `mavenCentral()` there for your project's other dependencies) * Add a `rewrite` section that will be filled in later Your file should look similar to: @@ -97,6 +108,13 @@ Once you've checked out your project, the next step is to add the OpenRewrite pl // The root project doesn't have to be a Java project, but this is necessary // to resolve recipe artifacts. mavenCentral() + maven { + url = uri("https://artifacts.codegenomeproject.org/maven") + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } rewrite { @@ -114,6 +132,37 @@ Once you've checked out your project, the next step is to add the OpenRewrite pl {{VERSION_REWRITE_MAVEN_PLUGIN}} ``` + + The plugin and recipe modules are resolved from the Code Genome Project, so you'll also need to add the repository to your `pom.xml`: + + ```markup title="pom.xml" + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + ``` + + Lastly, add your credentials to your Maven `settings.xml` file (typically at `~/.m2/settings.xml`). The username is the email or username you signed in with, and the password is your Code Genome Project token: + + ```markup title="settings.xml" + + + + codegenome + USERNAME + TOKEN + + + + ``` diff --git a/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md b/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md index 90e8d7cd84..c854aba17d 100644 --- a/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md +++ b/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md @@ -13,6 +13,10 @@ Most programmers agree that having consistent formatting across a code base make How you configure Checkstyle integration depends on whether or not your build also applies a Checkstyle plugin. For Gradle builds this means the built-in plugin named [Checkstyle Plugin](https://docs.gradle.org/current/userguide/checkstyle_plugin.html). For Maven builds this means [maven-checkstyle-plugin](https://maven.apache.org/plugins/maven-checkstyle-plugin/). +:::info +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the Gradle snippets below, replace `USERNAME` and `TOKEN` with your own credentials. See the [quickstart guide](../getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token and on configuring the repository and credentials for Maven. +::: + ### With Checkstyle Plugin If your build uses either the Gradle or Maven checkstyle plugins, then good news, the OpenRewrite build plugins will detect that and automatically match their configuration. All that remains is to activate the [Code cleanup](../../recipes/staticanalysis/codecleanup.md) recipe: @@ -68,7 +72,15 @@ rewrite { } repositories { - mavenCentral() // rewrite is published to Maven Central + mavenCentral() + // rewrite is published to the Code Genome Project + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { @@ -104,7 +116,15 @@ rewrite { } repositories { - mavenCentral() // rewrite is published to Maven Central + mavenCentral() + // rewrite is published to the Code Genome Project + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { @@ -171,7 +191,15 @@ rewrite { } repositories { - mavenCentral() // rewrite is published to Maven Central + mavenCentral() + // rewrite is published to the Code Genome Project + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { diff --git a/docs/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build.md b/docs/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build.md index 291dc29aa6..7f6f771e3d 100644 --- a/docs/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build.md +++ b/docs/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build.md @@ -54,6 +54,15 @@ rootProject { mavenCentral() } } + repositories { + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } + } } } ``` @@ -83,6 +92,15 @@ rootProject { mavenCentral() } } + repositories { + maven { + url = uri("https://artifacts.codegenomeproject.org/maven") + credentials { + username = "USERNAME" + password = "TOKEN" + } + } + } } } ``` @@ -92,6 +110,8 @@ rootProject { In the `rootProject` block, we specify a dependency that contains OpenRewrite Spring recipes (`rewrite-spring`). If you wanted, you could also define a `rewrite` section inside of the `rootProject` that has elements like `activeRecipe` or `activeStyle`. In general, though, it's better to [use the command line to specify the recipes or styles](#step-4-run-the-recipe) so that you can keep your init script fairly generic. +The `afterEvaluate` block adds the Code Genome Project repository, which OpenRewrite artifacts are distributed through. Sign in to the Code Genome Project to create a download token, then replace `USERNAME` with the email or username you signed in with and `TOKEN` with that token. See the [quickstart guide](./getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details. + For a full range of options available, please see our [Gradle plugin configuration doc](../reference/gradle-plugin-configuration.md) ### Step 3: (Optional) Create a custom declarative recipe diff --git a/docs/running-recipes/running-rewrite-on-an-infrastructure-as-code-project.md b/docs/running-recipes/running-rewrite-on-an-infrastructure-as-code-project.md index 449506a07a..90e3b76622 100644 --- a/docs/running-recipes/running-rewrite-on-an-infrastructure-as-code-project.md +++ b/docs/running-recipes/running-rewrite-on-an-infrastructure-as-code-project.md @@ -67,6 +67,15 @@ plugins { repositories { mavenCentral() + // OpenRewrite artifacts are distributed through the Code Genome Project. + // Use the email or username you signed in with, plus a download token as the password. + maven { + url = uri("https://artifacts.codegenomeproject.org/maven") + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } dependencies { diff --git a/docs/running-recipes/running-text-based-recipes.md b/docs/running-recipes/running-text-based-recipes.md index 3e3f8409c9..b5904ef18c 100644 --- a/docs/running-recipes/running-text-based-recipes.md +++ b/docs/running-recipes/running-text-based-recipes.md @@ -54,6 +54,10 @@ recipeList: Now that we have the recipe defined in our `rewrite.yml` file, we can update our `build.gradle` or `pom.xml` file to tell OpenRewrite to use the recipe we defined above: +:::info +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the Gradle snippet below, replace `USERNAME` and `TOKEN` with your own credentials. See the [quickstart guide](./getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token and on configuring the repository and credentials for Maven. +::: + ```groovy @@ -67,6 +71,13 @@ rewrite { repositories { mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } ``` diff --git a/src/components/RunRecipe/index.tsx b/src/components/RunRecipe/index.tsx index d32baf9462..60af196668 100644 --- a/src/components/RunRecipe/index.tsx +++ b/src/components/RunRecipe/index.tsx @@ -120,6 +120,13 @@ rewrite { repositories { mavenCentral() + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } } ${needsDependency ? `\ndependencies {\n rewrite("${groupId}:${artifactId}:${version}")\n}\n` : ''}`; @@ -144,6 +151,15 @@ rootProject { mavenCentral() } } + repositories { + maven { + url = "https://artifacts.codegenomeproject.org/maven" + credentials { + username = "USERNAME" + password = "TOKEN" + } + } + } } }`; @@ -168,11 +184,32 @@ rootProject { mavenCentral() } } + repositories { + maven { + url = uri("https://artifacts.codegenomeproject.org/maven") + credentials { + username = "USERNAME" + password = "TOKEN" + } + } + } } }`; // Maven POM snippet const mavenPom = ` + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + @@ -199,6 +236,30 @@ rootProject { // Maven CLI snippet const mavenCli = `mvn -U org.openrewrite.maven:rewrite-maven-plugin:run${needsDependency ? ` --define rewrite.recipeArtifactCoordinates=${groupId}:${artifactId}:RELEASE` : ''} --define rewrite.activeRecipes=${activeRecipeName}${dataTableCliFlag}`; + // Maven settings.xml snippet with Code Genome Project credentials + const mavenSettings = ` + + + codegenome + USERNAME + TOKEN + + +`; + + const cgpAuthNote = ( +

+ OpenRewrite artifacts are distributed through the Code Genome Project repository + (https://artifacts.codegenomeproject.org/maven), which requires authentication. Sign in to the Code + Genome Project to create a download token, then in the snippets below replace USERNAME with the + email or username you signed in with and TOKEN with that token. See the{' '} + + quickstart guide + {' '} + for details. +

+ ); + return ( <> {introText &&

{introText}

} @@ -213,6 +274,7 @@ rootProject { Now that {wrapperRecipeName(recipeName)} has been defined, activate it in your build file:

)} + {cgpAuthNote} {showGradle && ( @@ -266,6 +328,13 @@ rootProject { {showMaven && (
    +
  1. + Add the Code Genome Project credentials to your Maven settings.xml file (typically at{' '} + ~/.m2/settings.xml): + + {mavenSettings} + +
  2. Add the following to your pom.xml file: @@ -280,7 +349,8 @@ rootProject {

    You will need to have Maven installed on your machine - before you can run the following command. + before you can run the following command. You will also need the Code Genome Project repository and + credentials configured, as described in the Maven POM tab.

    {mavenCli} From 11a5fe3ef183aa2f8090a67616f4a1b2e7c6f579 Mon Sep 17 00:00:00 2001 From: Mike Solomon Date: Tue, 28 Jul 2026 10:10:32 -0700 Subject: [PATCH 2/2] Address PR feedback --- docs/authoring-recipes/data-tables.md | 33 +++++++++++- .../recipe-development-environment.md | 27 ++++++++++ ...automatically-fix-checkstyle-violations.md | 52 ++++++++++++++++++- .../running-text-based-recipes.md | 28 +++++++++- 4 files changed, 137 insertions(+), 3 deletions(-) diff --git a/docs/authoring-recipes/data-tables.md b/docs/authoring-recipes/data-tables.md index 690fa46358..4b3c245b85 100644 --- a/docs/authoring-recipes/data-tables.md +++ b/docs/authoring-recipes/data-tables.md @@ -274,7 +274,7 @@ By default, OpenRewrite recipes will **not** produce a data table. In order for 2. Next, you will either need to update build file or modify your command for running a recipe: :::info -OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the Gradle snippet below, replace `USERNAME` and `TOKEN` with your own credentials. See the [quickstart guide](../running-recipes/getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token and on configuring the repository and credentials for Maven. +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the snippets below, replace `USERNAME` with the email or username you signed in with and `TOKEN` with a download token. See the [quickstart guide](../running-recipes/getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token. ::: @@ -341,6 +341,37 @@ Add `true` to your `pom.xml` file such as i ``` + +Since the plugin and recipe modules are resolved from the Code Genome Project, add the repository to your `pom.xml` as well: + +```xml + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + +``` + +Then add your credentials to your Maven `settings.xml` file (typically at `~/.m2/settings.xml`): + +```xml title="settings.xml" + + + + codegenome + USERNAME + TOKEN + + + +```
    diff --git a/docs/authoring-recipes/recipe-development-environment.md b/docs/authoring-recipes/recipe-development-environment.md index 7eeefb002d..997a51f503 100644 --- a/docs/authoring-recipes/recipe-development-environment.md +++ b/docs/authoring-recipes/recipe-development-environment.md @@ -423,6 +423,19 @@ If you run into errors when trying to publish and read your recipe locally, try ```xml title="pom.xml" + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + @@ -447,6 +460,20 @@ If you run into errors when trying to publish and read your recipe locally, try ``` +Then add your Code Genome Project credentials to your Maven `settings.xml` file (typically at `~/.m2/settings.xml`), using the email or username you signed in with and a download token as the password: + +```xml title="settings.xml" + + + + codegenome + USERNAME + TOKEN + + + +``` + :::info If testing locally, your `rewrite` `dependency` should match the structure of your `.m2` folder. For example, if the path to your recipe in the `.m2` folder is: diff --git a/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md b/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md index c854aba17d..d01e49b34f 100644 --- a/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md +++ b/docs/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations.md @@ -14,9 +14,23 @@ Most programmers agree that having consistent formatting across a code base make How you configure Checkstyle integration depends on whether or not your build also applies a Checkstyle plugin. For Gradle builds this means the built-in plugin named [Checkstyle Plugin](https://docs.gradle.org/current/userguide/checkstyle_plugin.html). For Maven builds this means [maven-checkstyle-plugin](https://maven.apache.org/plugins/maven-checkstyle-plugin/). :::info -OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the Gradle snippets below, replace `USERNAME` and `TOKEN` with your own credentials. See the [quickstart guide](../getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token and on configuring the repository and credentials for Maven. +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the snippets below, replace `USERNAME` with the email or username you signed in with and `TOKEN` with a download token. See the [quickstart guide](../getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token. ::: +The Gradle snippets below carry those credentials inline. For Maven, they go in your `settings.xml` file instead (typically at `~/.m2/settings.xml`): + +```xml title="settings.xml" + + + + codegenome + USERNAME + TOKEN + + + +``` + ### With Checkstyle Plugin If your build uses either the Gradle or Maven checkstyle plugins, then good news, the OpenRewrite build plugins will detect that and automatically match their configuration. All that remains is to activate the [Code cleanup](../../recipes/staticanalysis/codecleanup.md) recipe: @@ -25,6 +39,18 @@ If your build uses either the Gradle or Maven checkstyle plugins, then good news ```xml title="pom.xml" + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + @@ -136,6 +162,18 @@ dependencies { ```xml title="pom.xml" + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + @@ -221,6 +259,18 @@ In Maven, the ordering of goals depends first on which phase of the [Build Lifec ```xml title="pom.xml" + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + diff --git a/docs/running-recipes/running-text-based-recipes.md b/docs/running-recipes/running-text-based-recipes.md index b5904ef18c..90a23e805f 100644 --- a/docs/running-recipes/running-text-based-recipes.md +++ b/docs/running-recipes/running-text-based-recipes.md @@ -55,7 +55,7 @@ recipeList: Now that we have the recipe defined in our `rewrite.yml` file, we can update our `build.gradle` or `pom.xml` file to tell OpenRewrite to use the recipe we defined above: :::info -OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the Gradle snippet below, replace `USERNAME` and `TOKEN` with your own credentials. See the [quickstart guide](./getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token and on configuring the repository and credentials for Maven. +OpenRewrite artifacts are distributed through the Code Genome Project repository, which requires authentication. In the snippets below, replace `USERNAME` with the email or username you signed in with and `TOKEN` with a download token. See the [quickstart guide](./getting-started.md#step-2-add-rewrite-maven-plugin-or-rewrite-gradle-plugin-to-your-project) for details on creating a token. ::: @@ -85,6 +85,18 @@ repositories { ```xml + + + codegenome + https://artifacts.codegenomeproject.org/maven + + + + + codegenome + https://artifacts.codegenomeproject.org/maven + + @@ -101,6 +113,20 @@ repositories { ``` + +Your Code Genome Project credentials go in your Maven `settings.xml` file (typically at `~/.m2/settings.xml`): + +```xml title="settings.xml" + + + + codegenome + USERNAME + TOKEN + + + +```