Links
Comment on page

Migrate Hibernate dependencies to 6.1.x

org.openrewrite.hibernate.MigrateToHibernateDependencies61
This recipe will migrate any existing dependencies on Hibernate 5.x to the latest 6.1.x release. This migration will include the adjustment to the new org.hibernate.orm group ID. It accounts for artifacts names that both do and do not include the jakarta suffix and it will change both dependencies and managed dependencies.

Recipe source

  • groupId: org.openrewrite.recipe
  • artifactId: rewrite-hibernate
  • version: 1.0.7
This recipe is composed of more than one recipe. If you want to customize the set of recipes this is composed of, you can find and copy the GitHub source for the recipe from the link above.

Usage

This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-hibernate:1.0.7 in your build file or by running a shell command (in which case no build changes are needed):
Gradle
Gradle init script
Maven POM
Maven Command Line
Moderne CLI
  1. 1.
    Add the following to your build.gradle file:
build.gradle
plugins {
id("org.openrewrite.rewrite") version("6.5.6")
}
rewrite {
activeRecipe("org.openrewrite.hibernate.MigrateToHibernateDependencies61")
}
repositories {
mavenCentral()
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-hibernate:1.0.7")
}
  1. 2.
    Run gradle rewriteRun to run the recipe.
  1. 1.
    Create a file named init.gradle in the root of your project.
init.gradle
initscript {
repositories {
maven { url "https://plugins.gradle.org/m2" }
}
dependencies { classpath("org.openrewrite:plugin:6.5.6") }
}
rootProject {
plugins.apply(org.openrewrite.gradle.RewritePlugin)
dependencies {
rewrite("org.openrewrite.recipe:rewrite-hibernate:1.0.7")
}
rewrite {
activeRecipe("org.openrewrite.hibernate.MigrateToHibernateDependencies61")
}
afterEvaluate {
if (repositories.isEmpty()) {
repositories {
mavenCentral()
}
}
}
}
  1. 2.
    Run gradle --init-script init.gradle rewriteRun to run the recipe.
  1. 1.
    Add the following to your pom.xml file:
pom.xml
<project>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.13.0</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.hibernate.MigrateToHibernateDependencies61</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-hibernate</artifactId>
<version>1.0.7</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
  1. 2.
    Run mvn rewrite:run to run the recipe.
shell
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-hibernate:RELEASE \
-Drewrite.activeRecipes=org.openrewrite.hibernate.MigrateToHibernateDependencies61
You will need to have configured the Moderne CLI on your machine before you can run the following command.
shell
mod run . --recipe MigrateToHibernateDependencies61

Definition

Recipe List
Yaml Recipe List
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.hibernate.MigrateToHibernateDependencies61
displayName: Migrate Hibernate dependencies to 6.1.x
description: This recipe will migrate any existing dependencies on Hibernate 5.x to the latest 6.1.x release. This migration will include the adjustment to the new `org.hibernate.orm` group ID. It accounts for artifacts names that both do and do not include the `jakarta` suffix and it will change both dependencies and managed dependencies.
recipeList:
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-agroal
newGroupId: org.hibernate.orm
newArtifactId: hibernate-agroal
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-agroal-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-agroal
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-agroal
newGroupId: org.hibernate.orm
newArtifactId: hibernate-agroal
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-agroal-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-agroal
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-c3p0
newGroupId: org.hibernate.orm
newArtifactId: hibernate-c3p0
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-c3p0-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-c3p0
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-c3p0
newGroupId: org.hibernate.orm
newArtifactId: hibernate-c3p0
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-c3p0-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-c3p0
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-community-dialects
newGroupId: org.hibernate.orm
newArtifactId: hibernate-community-dialects
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-community-dialects-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-community-dialects
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-community-dialects
newGroupId: org.hibernate.orm
newArtifactId: hibernate-community-dialects
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-community-dialects-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-community-dialects
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-core
newGroupId: org.hibernate.orm
newArtifactId: hibernate-core
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-core-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-core
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-core
newGroupId: org.hibernate.orm
newArtifactId: hibernate-core
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-core-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-core
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-envers
newGroupId: org.hibernate.orm
newArtifactId: hibernate-envers
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-envers-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-envers
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-envers
newGroupId: org.hibernate.orm
newArtifactId: hibernate-envers
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-envers-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-envers
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-graalvm
newGroupId: org.hibernate.orm
newArtifactId: hibernate-graalvm
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-graalvm-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-graalvm
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-graalvm
newGroupId: org.hibernate.orm
newArtifactId: hibernate-graalvm
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-graalvm-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-graalvm
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-hikaricp
newGroupId: org.hibernate.orm
newArtifactId: hibernate-hikaricp
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-hikaricp-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-hikaricp
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-hikaricp
newGroupId: org.hibernate.orm
newArtifactId: hibernate-hikaricp
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
oldGroupId: org.hibernate
oldArtifactId: hibernate-hikaricp-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-hikaricp
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-jcache
newGroupId: org.hibernate.orm
newArtifactId: hibernate-jcache
newVersion: 6.1.x
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: org.hibernate
oldArtifactId: hibernate-jcache-jakarta
newGroupId: org.hibernate.orm
newArtifactId: hibernate-jcache
newVersion: 6.1.x
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId: