openrewrite / openrewrite/rewrite
Recipe to use managed dependency versions
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What problem are you trying to solve?
Many builds, including ours, find it convenient to manage dependency versions via a Bill of Materials (BOM).
Amongst our Maven dependency management recipes we have org.openrewrite.maven.ManagedDependencies which provides this functionality for Maven. A Gradle equivalent is desirable.
What precondition(s) should be checked before applying this recipe?
The DependencyHandler.platform() function was added to Gradle in version 5.0. This recipe is inapplicable to earlier versions of Gradle.
Describe the situation before applying the recipe
Assuming the recipe were being configured to manage rewrite versions via rewrite-bom, a build.gradle file might look like this:
dependencies {
implementation("org.openrewrite:rewrite-core:latest.release")
}
Describe the situation after applying the recipe
dependencies {
implementation(platform("org.openrewrite:rewrite-bom:latest.release"))
implementation("org.openrewrite:rewrite-core")
}
Any additional context
After this recipe is created a composite of it and its maven equivalent should be added to rewrite-java-dependencies
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing org.openrewrite.maven.ManagedDependencies recipe and the rewrite-java-dependencies composite. Check how build.gradle dependencies are represented and how DependencyHandler.platform() applies for Gradle 5.0 and later. Done means a Gradle recipe produces the shown BOM platform dependency and removes the managed version from the original dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100