openrewrite / openrewrite/rewrite-spring

`spring-cloud-dependencies` upgrade drops `commons-collections4` version

Open
#556 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

boot-3.2 bug
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

As reported on Slack by @wabrit

I have a composite recipe which makes some changes to a POM; the source POM declares a dependency on org.apache.commons:commons-collections4 which is expressed via a property and dependency i.e.

<project>
  ...
  <properties>
    <commons-collections4.version>4.4</commons-collections4.version>
  </properties>
  <dependencies>
    <dependency>
      <dependency>
	<groupId>org.apache.commons</groupId>
	<artifactId>commons-collections4</artifactId>
        <version>${commons-collections4.version}</version>
      </dependency>

My recipe doesn't attempt to modify this dependency, and running under OR 2.6 indeed this dependency is not modified.
But under OR 2.15 after I run my recipe the dependency has had its <version> element removed, which causes a maven error Could not find artifact org.apache.commons:commons-collections4:pom:unknown
I'm not sure what's caused the pom to be changed in this way, nor how to fix it.

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 the composite-recipe and Maven POM example in the issue, reproducing the behavior under OpenRewrite 2.6 and 2.15. Trace why an untouched commons-collections4 dependency loses its version property reference; done means the dependency retains its version and Maven no longer reports an unknown artifact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.