openrewrite / openrewrite/rewrite

`UpdateProperty`: change a properties value

Open
#4,797 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maven recipe
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

What problem are you trying to solve?

I want to update a property <main.groupId>com.example.ws4</main.groupId> from ws4 to ws5. However, we have like 200 repositories (90% maven), and I don't know for certain what the property name is in each. But I know the value.

So I would like to search the properties based on the value, and if encountered: change it to the new value.

What precondition(s) should be checked before applying this recipe?

none that I can think of

Describe the situation before applying the recipe

<main.groupId>com.example.ws4</main.groupId>

Describe the situation after applying the recipe

<main.groupId>com.example.ws5</main.groupId>

Have you considered any alternatives or workarounds?

org.openrewrite.xml.ChangeTagValue can be used, but I feel it's not so clean. Especially because values in properties can still contain properties that needs to be interpreted.

Are you interested in contributing this recipe to OpenRewrite?

Maybe

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 by reading the existing org.openrewrite.xml.ChangeTagValue recipe and the surrounding OpenRewrite XML recipe entry points. Define completion as finding properties by their current value, including values containing properties that still need interpretation, and changing matching values from ws4 to ws5 without requiring the property name.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
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.