Skip to content

Commit

Permalink
feat(dependencies): Switched to change dependency plugin [#2][#3]
Browse files Browse the repository at this point in the history
  • Loading branch information
javahippie committed Nov 20, 2024
1 parent f4655fd commit 27c037f
Show file tree
Hide file tree
Showing 3 changed files with 266 additions and 9 deletions.
18 changes: 16 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
<version>7.22.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.operaton.bpm</groupId>
<artifactId>operaton-engine</artifactId>
<version>1.0.0-beta-1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down Expand Up @@ -114,8 +128,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>8</source>
<target>8</target>
<source>17</source>
<target>17</target>
<testSource>17</testSource>
<testTarget>17</testTarget>
<compilerArgs>
Expand Down
175 changes: 170 additions & 5 deletions src/main/resources/META-INF/rewrite/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
82 changes: 80 additions & 2 deletions src/test/java/org/operaton/rewrite/MigrateDependenciesTest.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -16,7 +16,7 @@ public void defaults(RecipeSpec spec) {
}

@Test
void migrateCamundaEngine() {
void migrateCamundaEngineMaven() {
rewriteRun(
mavenProject("project", pomXml(
"""
Expand Down Expand Up @@ -50,4 +50,82 @@ void migrateCamundaEngine() {
""")));
}

@Test
void migrateCamundaEngineWithManagedVersionMaven() {
rewriteRun(
mavenProject("project", pomXml(
//language=xml
"""
<project>
<groupId>org.operaton.test</groupId>
<artifactId>test-app</artifactId>
<version>1</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-bom</artifactId>
<version>7.22.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
</dependency>
</dependencies>
</project>
""",

//language=xml
"""
<project>
<groupId>org.operaton.test</groupId>
<artifactId>test-app</artifactId>
<version>1</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.operaton.bpm</groupId>
<artifactId>operaton-bom</artifactId>
<version>1.0.0-beta-1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.operaton.bpm</groupId>
<artifactId>operaton-engine</artifactId>
</dependency>
</dependencies>
</project>
""")));
}

@Test
void migrateCamundaEngineGradle() {
rewriteRun(

Check failure on line 112 in src/test/java/org/operaton/rewrite/MigrateDependenciesTest.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

MigrateDependenciesTest.migrateCamundaEngineGradle

Recipe was expected to make a change but made no changes.
Raw output
java.lang.AssertionError: Recipe was expected to make a change but made no changes.
	at org.openrewrite.test.LargeSourceSetCheckingExpectedCycles.afterCycle(LargeSourceSetCheckingExpectedCycles.java:119)
	at org.openrewrite.RecipeScheduler.runRecipeCycles(RecipeScheduler.java:98)
	at org.openrewrite.RecipeScheduler.scheduleRun(RecipeScheduler.java:41)
	at org.openrewrite.Recipe.run(Recipe.java:376)
	at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:376)
	at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
	at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
	at org.operaton.rewrite.MigrateDependenciesTest.migrateCamundaEngineGradle(MigrateDependenciesTest.java:112)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
//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'
}
"""));
}
}

0 comments on commit 27c037f

Please sign in to comment.