Skip to content

Commit

Permalink
Fix mysql dependency in 2.5 already (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek authored Nov 25, 2023
1 parent 4b09166 commit 5b1458f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
9 changes: 9 additions & 0 deletions src/main/resources/META-INF/rewrite/spring-boot-25.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ recipeList:
addIfMissing: false
- org.openrewrite.java.spring.boot2.MigrateDatabaseCredentials

# Spring Boot 2.5 mismanages a pom-only redirect pom of mysql:mysql-connector-java:8.0.33
# From 2.6 onwards the managed dependency is com.mysql:mysql-connector-j:8.0.33
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: mysql
newGroupId: com.mysql
oldArtifactId: mysql-connector-java
newArtifactId: mysql-connector-j
newVersion: 8.0.x

# Use recommended replacements for deprecated APIs
- org.openrewrite.java.spring.boot2.MigrateActuatorMediaTypeToApiVersion
- org.openrewrite.java.ChangeType:
Expand Down
8 changes: 0 additions & 8 deletions src/main/resources/META-INF/rewrite/spring-boot-26.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ recipeList:
pluginIdPattern: org.springframework.boot
newVersion: 2.6.x

# From 2.6 onwards the managed dependency is com.mysql:mysql-connector-j:8.0.33
- org.openrewrite.java.dependencies.ChangeDependency:
oldGroupId: mysql
newGroupId: com.mysql
oldArtifactId: mysql-connector-java
newArtifactId: mysql-connector-j
newVersion: 8.0.x

# Update properties
- org.openrewrite.java.spring.boot2.SpringBootProperties_2_6

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@

@Issue("https://github.com/openrewrite/rewrite-spring/issues/274")
class UpdateMysqlDriverArtifactIdTest implements RewriteTest {

@Override
public void defaults(RecipeSpec spec) {
spec.recipe(Environment.builder()
.scanRuntimeClasspath("org.openrewrite.java.spring")
.build()
.activateRecipes("org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_7"));
.activateRecipes("org.openrewrite.java.spring.boot2.UpgradeSpringBoot_2_5"));
}

@Nested
Expand Down Expand Up @@ -189,7 +188,7 @@ void doNotPinWhenNotVersioned() {
"""
plugins {
id 'java'
id 'org.springframework.boot' version '2.6.1'
id 'org.springframework.boot' version '2.5.14'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}
Expand All @@ -201,8 +200,8 @@ void doNotPinWhenNotVersioned() {
runtimeOnly 'mysql:mysql-connector-java'
}
""", spec -> spec.after(gradle -> {
Matcher version = Pattern.compile("2\\.7\\.\\d+").matcher(gradle);
assertThat(version.find()).describedAs("Expected 2.7.x in %s", gradle).isTrue();
Matcher version = Pattern.compile("2\\.5\\.\\d+").matcher(gradle);
assertThat(version.find()).describedAs("Expected 2.5.x in %s", gradle).isTrue();
//language=gradle
return """
plugins {
Expand Down

0 comments on commit 5b1458f

Please sign in to comment.