Consider introducing OpenRewrite recipes for Docling Java
Even though the project is not GA yet, it would be nice to provide OpenRewrite recipes to automate refactoring when updating to newer versions, taking care of breaking changes without any manual intervention.
For example, we changed some packages in version 0.2 and 0.3.
For now, I publish OpenRewrite recipes as part of my Arconia Migrations project, which is a catalog of open-source recipes for JUnit, Testcontainers, Spring, Arconia, and other Java-related libraries.
They can be run from the rewrite-docling module (fully dedicated to Docling) using any of the OpenRewrite approaches, including the Maven plugin:
./mvnw -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.recipeArtifactCoordinates=io.arconia.migrations:rewrite-docling:LATEST \
-Drewrite.activeRecipes=io.arconia.rewrite.docling.UpgradeDocling_0_3
I'd be happy to contribute those recipes upstream, if we decide to adopt OpenRewrite. If we do, my suggestion would be to keep the recipes separate from the main packages, and with a separate release lifecycle. It's likely we need to make changes to recipes outside the main release lifecycle. Also, some recipes need the new version already published in order to be tested, so we can't keep the recipes in the same place. If not, I'd be happy to continue maintaining them in my project :)
I think we'd love to have them
We publish OpenRewrite recipes with quarkus (for easy upgrades) and we version the recipes together with quarkus.
I can look into how we do that if you'd like.
That'd be great, thanks!
From what I experienced, if we don't foresee implementing imperative recipes manipulating the Java code using APIs from the latest Docling Java release, we shouldn't have issues in keeping the recipes as part of the main project.
But if we need some of those recipes at some point, we might need some workarounds since the parserClasspath configuration in the OpenRewrite build plugin doesn't work for dependencies on other modules in the same project. I quickly looked into a workaround, and it would require us to change the dependencies for the recipe on each release (moving from "project" dependency to direct versioned dependency).
Instead of using a project dependency you could use a hard-coded version. Our gradle plugins set the version property based on the release.current-version from the .github/project.yml file.
You could do something like this:
recipeDependencies {
parserClasspath "${rootProject.group}:${project(':docling-serve-api').name}:$version"
}
This way we're still referencing the project artifacts from the Gradle DSL and getting the current version. This way it would also work when we publish the release.
We'd just have to ensure that the publishToMavenLocal task is wired in before tests execute (that way the locally-compiled libs get published to the local maven repo). We'd also have to add regular dependencies on the other projects to enforce that the others get compiled/etc before the recipes.
Although looking into how Quarkus does it - it looks like we have a separate repo for update recipes like you do
https://github.com/quarkusio/quarkus-updates
Maybe we should close this task now that OpenRewrite is not open anymore. The library artifacts are not published to Maven Central, but on Moderne's proprietary repository which requires a dedicated token.
For now, I still have my Arconia Migrations project alive, but I don't know for how long it can continue to exist. Here's the Docling 0.7 upgrade recipe: https://docs.arconia.io/arconia-migrations/latest/recipe-catalog/rewrite-docling/#io_arconia_rewrite_docling_UpgradeDocling_0_7
You're a maintainer so feel free to close it :)
If there's no objection, I'll close it then :)