openrewrite / openrewrite/rewrite

org.openrewrite.gradle.UpgradeDependencyVersion does not support dynamic versions

Open
#6,567 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement gradle recipe
Dominant language
Java
Stars
3.7k
Forks
571
Avg merge
13h 12m
Merged PRs (30d)
261

Description

What version of OpenRewrite are you using?

I am using

  • OpenRewrite BOM v3.22.0
  • Maven/Gradle plugin v7.24.0
  • rewrite-gradle (via the BOM listed above)

How are you running OpenRewrite?

I am using the Gradle plugin, and my project is a multi module project.

I've recreated the issue in this repo: https://github.com/sleylandcole-ccc/openrewrite-upgrade-dependency-exact-version. There is a recipe module which contains a recipe to upgrade the Jackson Core dependency to 2.20.+.

The consumer project has a dependency on Jackson Core 2.18.5. You can run the recipe against this module: ./gradlew :consumer:rewriteRun

What is the smallest, simplest way to reproduce the problem?

See repo linked above

What did you expect to see?

This behaviour was described in a Slack message from @shanman190 (here).

I expected the version to be set to 2.20.+ as per the recipe

implementation("com.fasterxml.jackson.core:jackson-core:2.20.+")

What did you see instead?

The version was unchanged

implementation("com.fasterxml.jackson.core:jackson-core:2.18.5")

What is the full stack trace of any errors you encountered?

No errors

Are you interested in contributing a fix to OpenRewrite?

Depending on the amount of work, I could potentially contribute a fix. I will need some guidance on what to change as I haven't contributed to OpenRewrite before.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.openrewrite.gradle.UpgradeDependencyVersion and reproduce the issue using the linked example repository with ./gradlew :consumer:rewriteRun. Trace why the recipe leaves 2.18.5 unchanged when targeting 2.20.+, then add coverage showing that the dependency version becomes 2.20.+.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.