diff --git a/pom.xml b/pom.xml index ca8aa05..8ef42ff 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,20 @@ test + + org.camunda.bpm + camunda-engine + 7.22.0 + test + + + + org.operaton.bpm + operaton-engine + 1.0.0-beta-1 + test + + org.assertj assertj-core @@ -114,8 +128,8 @@ maven-compiler-plugin 3.13.0 - 8 - 8 + 17 + 17 17 17 diff --git a/src/main/resources/META-INF/rewrite/dependencies.yml b/src/main/resources/META-INF/rewrite/dependencies.yml index 9195a96..b7dc63a 100644 --- a/src/main/resources/META-INF/rewrite/dependencies.yml +++ b/src/main/resources/META-INF/rewrite/dependencies.yml @@ -20,16 +20,181 @@ name: org.operaton.rewrite.ReplaceCamundaDependencies displayName: Rewrite the dependencies in `pom.xml` description: Replaces the `org.camunda.*` occurrences with `org.operaton.*` dependencies. recipeList: - - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + - org.openrewrite.java.dependencies.ChangeDependency: oldGroupId: org.camunda.bpm newGroupId: org.operaton.bpm newVersion: 1.0.0-beta-1 oldArtifactId: camunda-engine newArtifactId: operaton-engine - - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-spring + newArtifactId: operaton-engine-spring + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-bpm-junit5 + newArtifactId: operaton-bpm-junit5 + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-bom + newArtifactId: operaton-bom + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-bom-root + newArtifactId: operaton-bom-root + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-external-task-client-spring + newArtifactId: operaton-external-task-client-spring + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-external-task-client + newArtifactId: operaton-external-task-client + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-spring-6 + newArtifactId: operaton-engine-spring-6 + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-core-internal-dependencies + newArtifactId: operaton-core-internal-dependencies + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-parent + newArtifactId: operaton-parent + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-rest-root + newArtifactId: operaton-engine-rest-root + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-bpm-assert-root + newArtifactId: operaton-bpm-assert-root + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-rest-jakarta + newArtifactId: operaton-engine-rest-jakarta + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-cdi-compatibility-root + newArtifactId: operaton-cdi-compatibility-root + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-plugins + newArtifactId: operaton-engine-plugins + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-bpm-assert + newArtifactId: operaton-bpm-assert + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-rest-openapi-generator + newArtifactId: operaton-engine-rest-openapi-generator + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-rest + newArtifactId: operaton-engine-rest + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: docs + newArtifactId: docs + - org.openrewrite.java.dependencies.ChangeDependency: oldGroupId: org.camunda.bpm newGroupId: org.operaton.bpm newVersion: 1.0.0-beta-1 - changeManagedDependency: true - oldArtifactId: camunda-bom - newArtifactId: operaton-bom + oldArtifactId: camunda-engine-cdi + newArtifactId: operaton-engine-cdi + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-database-settings + newArtifactId: operaton-database-settings + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-root + newArtifactId: operaton-root + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-plugin-connect + newArtifactId: operaton-engine-plugin-connect + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-external-task-client-root + newArtifactId: operaton-external-task-client-root + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-rest-core + newArtifactId: operaton-engine-rest-core + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-only-bom + newArtifactId: operaton-only-bom + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-cdi-jakarta + newArtifactId: operaton-engine-cdi-jakarta + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-engine-plugin-spin + newArtifactId: operaton-engine-plugin-spin + - org.openrewrite.java.dependencies.ChangeDependency: + oldGroupId: org.camunda.bpm + newGroupId: org.operaton.bpm + newVersion: 1.0.0-beta-1 + oldArtifactId: camunda-spring-compatibility-root + newArtifactId: operaton-spring-compatibility-root + - org.openrewrite.java.ChangePackage: + oldPackageName: org.camunda + newPackageName: org.operaton + recursive: true \ No newline at end of file diff --git a/src/test/java/org/operaton/rewrite/MigrateDependenciesTest.java b/src/test/java/org/operaton/rewrite/MigrateDependenciesTest.java index 7cb886d..a9a4191 100644 --- a/src/test/java/org/operaton/rewrite/MigrateDependenciesTest.java +++ b/src/test/java/org/operaton/rewrite/MigrateDependenciesTest.java @@ -1,10 +1,10 @@ package org.operaton.rewrite; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.openrewrite.test.RecipeSpec; import org.openrewrite.test.RewriteTest; +import static org.openrewrite.gradle.Assertions.buildGradle; import static org.openrewrite.java.Assertions.mavenProject; import static org.openrewrite.maven.Assertions.pomXml; @@ -16,7 +16,7 @@ public void defaults(RecipeSpec spec) { } @Test - void migrateCamundaEngine() { + void migrateCamundaEngineMaven() { rewriteRun( mavenProject("project", pomXml( """ @@ -50,4 +50,82 @@ void migrateCamundaEngine() { """))); } + @Test + void migrateCamundaEngineWithManagedVersionMaven() { + rewriteRun( + mavenProject("project", pomXml( + //language=xml + """ + + org.operaton.test + test-app + 1 + + + + org.camunda.bpm + camunda-bom + 7.22.0 + import + pom + + + + + + org.camunda.bpm + camunda-engine + + + + """, + + //language=xml + """ + + org.operaton.test + test-app + 1 + + + + org.operaton.bpm + operaton-bom + 1.0.0-beta-1 + import + pom + + + + + + org.operaton.bpm + operaton-engine + + + + """))); + } + + @Test + void migrateCamundaEngineGradle() { + rewriteRun( + //language=groovy + buildGradle(""" + dependencies { + implementation 'org.camunda.bpm:camunda-engine:7.22.0' + } + """, + """ + plugins { + id "java-library" + } + repositories { + mavenCentral() + } + dependencies { + implementation 'org.operaton.bpm:operaton-engine:1.0.0-beta-1' + } + """)); + } }