Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/authoring-recipes/data-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.
:::

<Tabs>

<TabItem value="build.gradle" label="build.gradle">
Expand All @@ -290,6 +294,13 @@ rewrite {

repositories {
mavenCentral()
maven {
url = "https://artifacts.codegenomeproject.org/maven"
credentials {
username = "USERNAME"
password = "TOKEN"
}
}
}

dependencies {
Expand Down Expand Up @@ -330,6 +341,37 @@ Add `<exportDatatables>true</exportDatatables>` to your `pom.xml` file such as i
</dependencies>
</plugin>
```

Since the plugin and recipe modules are resolved from the Code Genome Project, add the repository to your `pom.xml` as well:

```xml
<repositories>
<repository>
<id>codegenome</id>
<url>https://artifacts.codegenomeproject.org/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>codegenome</id>
<url>https://artifacts.codegenomeproject.org/maven</url>
</pluginRepository>
</pluginRepositories>
```

Then add your credentials to your Maven `settings.xml` file (typically at `~/.m2/settings.xml`):

```xml title="settings.xml"
<settings>
<servers>
<server>
<id>codegenome</id>
<username>USERNAME</username>
<password>TOKEN</password>
</server>
</servers>
</settings>
```
</TabItem>

<TabItem value="maven-command-line" label="Maven command line">
Expand Down
36 changes: 36 additions & 0 deletions docs/authoring-recipes/recipe-development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -414,6 +423,19 @@ If you run into errors when trying to publish and read your recipe locally, try
<TabItem value="maven" label="Maven">
```xml title="pom.xml"
<project>
<!-- The rewrite core libraries are distributed through the Code Genome Project. -->
<repositories>
<repository>
<id>codegenome</id>
<url>https://artifacts.codegenomeproject.org/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>codegenome</id>
<url>https://artifacts.codegenomeproject.org/maven</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
Expand All @@ -438,6 +460,20 @@ If you run into errors when trying to publish and read your recipe locally, try
</project>
```

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"
<settings>
<servers>
<server>
<id>codegenome</id>
<username>USERNAME</username>
<password>TOKEN</password>
</server>
</servers>
</settings>
```

:::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:

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
38 changes: 35 additions & 3 deletions docs/reference/gradle-plugin-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
```

Expand Down Expand Up @@ -73,6 +91,13 @@ plugins {

repositories {
mavenCentral()
maven {
url = "https://artifacts.codegenomeproject.org/maven"
credentials {
username = "USERNAME"
password = "TOKEN"
}
}
}

rewrite {
Expand All @@ -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:
Expand All @@ -119,6 +144,13 @@ plugins {

repositories {
mavenCentral()
maven {
url = "https://artifacts.codegenomeproject.org/maven"
credentials {
username = "USERNAME"
password = "TOKEN"
}
}
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/snapshot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
55 changes: 52 additions & 3 deletions docs/running-recipes/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

<Tabs groupId="projectType">
<TabItem value="gradle-groovy" label="Gradle (Groovy)">
* 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:
Expand All @@ -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 {
Expand All @@ -81,7 +92,7 @@ Once you've checked out your project, the next step is to add the OpenRewrite pl
</TabItem>
<TabItem value="gradle-kotlin" label="Gradle (Kotlin)">
* 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:
Expand All @@ -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 {
Expand All @@ -114,6 +132,37 @@ Once you've checked out your project, the next step is to add the OpenRewrite pl
<version>{{VERSION_REWRITE_MAVEN_PLUGIN}}</version>
</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"
<repositories>
<repository>
<id>codegenome</id>
<url>https://artifacts.codegenomeproject.org/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>codegenome</id>
<url>https://artifacts.codegenomeproject.org/maven</url>
</pluginRepository>
</pluginRepositories>
```

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"
<settings>
<servers>
<server>
<id>codegenome</id>
<username>USERNAME</username>
<password>TOKEN</password>
</server>
</servers>
</settings>
```
</TabItem>

</Tabs>
Expand Down
Loading