Migrate to Mockbukkit 4 using OpenRewrite
Migration to version 4 was carefully automated by the MockBukkit team using OpenRewrite scripts to facilitate the migration process. To run the scripts, follow the steps for your package manager.
If you are using Maven, you can do the migration by executing the following command:
bash
mvn org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=org.mockbukkit.rewrite:openrewrite-recipes:1.0.2 \
-Drewrite.activeRecipes=org.mockbukkit.rewrite.PackageRename,org.mockbukkit.rewrite.ClassRename
Otherwise, you will need to add OpenRewrite plugin to your project with the correct configuration:
xml
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.42.2</version>
<!--Add the recipe source to your project’s rewrite configuration-->
<configuration>
<activeRecipes>
<recipe>org.mockbukkit.rewrite.PackageRename</recipe>
<recipe>org.mockbukkit.rewrite.ClassRename</recipe>
</activeRecipes>
</configuration>
<!--Add the Mockbukkit recipes-->
<dependencies>
<dependency>
<groupId>org.mockbukkit.rewrite</groupId>
<artifactId>openrewrite-recipes</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
</plugin>
<!-- Other plugins-->
</plugins>
kotlin
plugins {
id("org.openrewrite.rewrite") version "6.x.x"
}
dependencies {
// Add the Mockbukkit recipes
rewrite("org.mockbukkit.rewrite:openrewrite-recipes:1.0.2")
}
// Add the recipe source to your project’s rewrite configuration
rewrite {
activeRecipe("org.mockbukkit.rewrite.PackageRename")
activeRecipe("org.mockbukkit.rewrite.ClassRename")
}
groovy
plugins {
id("org.openrewrite.rewrite") version "6.x.x"
}
dependencies {
// Add the Mockbukkit recipes
rewrite("org.mockbukkit.rewrite:openrewrite-recipes:1.0.2")
}
// Add the recipe source to your project’s rewrite configuration
rewrite {
activeRecipe("org.mockbukkit.rewrite.PackageRename")
activeRecipe("org.mockbukkit.rewrite.ClassRename")
}
Run OpenRewrite to refactor your code:
bash
mvn rewrite:run
bash
./gradlew rewriteRun