Using OpenRewrite to Enable Develocity Project Integration and Rollout at Scale
Connecting hundreds or thousands of projects to Develocity (formerly Gradle Enterprise) for the first time can be challenging. The canonical way requires modifying the existing build configuration settings, which is not easily done at scale. This document explains how to use OpenRewrite from Moderne to create pull requests that will update all repositories at once.
What is OpenRewrite?
OpenRewrite is a tool that analyzes code and applies “recipes” to change code in a reliable way. You can execute recipes either with OpenRewrite’s Gradle/Maven plugins or with Moderne’s SaaS offering.
We collaborated with the Moderne team to create new recipes that add the Develocity configuration to Gradle and Maven projects:
What is Gradle Develocity
Develocity is the leading software solution for improving developer productivity and the developer experience. It achieves this by leveraging advanced build and test performance acceleration technologies, such as build caching, predictive test selection, and test distribution. In addition, failure reports and analytics make troubleshooting more efficient and toolchains more reliable by providing build environment observability, trends, and insights.
The most prestigious software development teams use Develocity to give developers back as much as two days per week in lost productivity time. It is a key enabling technology for the emerging practice of Developer Productivity Engineering and supports Maven, Bazel, sbt (in beta), and Gradle build systems.
Run OpenRewrite recipes
You can run recipes with a Gradle script or Maven goal, but it requires extra scripting to apply them to many repositories. Alternatively, Moderne’s SaaS offering can be used to conveniently run the recipes.
Below, we show how to add the Develocity Gradle plugin to a set of projects, using Apache Software Foundation projects as our examples. The process for adding the Develocity Maven extension is very similar.
- First, log in to Moderne.io.
- Select your organization containing the repositories you want to instrument with Develocity (Apache is chosen as an example).
- Search for Add the Develocity Gradle plugin recipe and select it.
- Set the Server URL field to the URL of your Develocity server, in this case https://ge.apache.org. The other parameters do not need to be set in this example. If you are interested in knowing more about when to use them, you can check the Develocity Gradle plugin documentation.
- Click on Dry run to preview the changes
- After selecting a repository by clicking on and giving permissions to Moderne, you can view the planned changes by the recipe.
- Then, after clicking on Commit results, you are prompted with a dialog to create a Pull Request (or the option to commit directly if you have permission).
Of course, you can create batch Pull Requests by selecting several rows on the summary page and clicking on the Commit results button.
You can view an example pull request created by the OpenRewrite “Add the Develocity Gradle plugin” recipe.
You can use the same mechanism on private Git repositories.
Summary and next steps
This article has shown you how to connect Develocity with your projects and update hundreds or thousands of repositories with a few clicks using OpenRewrite. But that’s just the tip of the iceberg. You can migrate from the older javax packages to the Jakarta equivalent, update to the latest version of Spring Boot, or update the Gradle Build Tool Wrapper version.
Here are several resources for learning more deployment, integration, and developer productivity engineering best practices:
- Explore the Develocity blog.
- Subscribe to the DPE newsletter to get regular expert takes and user/practitioner best practices.
- Dig into the Develocity documentation to discover advanced features and tips that can streamline your deployment and time-to-business impact.