openrewrite / openrewrite/rewrite

Extract Maven dependencies/plugin versions as properties

Open
#7,654 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This recipe should extract all versions from dependecies and plugins as properties.

What problem are you trying to solve?

I would like to handle all versions in pom.xml as properties

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

none

Describe the situation before applying the recipe

              <project>
                <groupId>com.example</groupId>
                <artifactId>my-app</artifactId>
                <version>1.0.0</version>
                <dependencies>
                  <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>4.13.2</version>
                    <scope>test</scope>
                  </dependency>
                  <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                    <version>1.7.36</version>
                  </dependency>
                </dependencies>
              </project>

Describe the situation after applying the recipe

              <project>
                <groupId>com.example</groupId>
                <artifactId>my-app</artifactId>
                <version>1.0.0</version>
                <properties>
                  <junit.version>4.13.2</junit.version>
                  <slf4j-api.version>1.7.36</slf4j-api.version>
                </properties>
                <dependencies>
                  <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>${junit.version}</version>
                    <scope>test</scope>
                  </dependency>
                  <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                    <version>${slf4j-api.version}</version>
                  </dependency>
                </dependencies>
              </project>

Have you considered any alternatives or workarounds?

I am not aware of any.

Any additional context

Are you interested in contributing this recipe to OpenRewrite?

Yes, I am working on PR.

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

The issue names no repository files, tests, or entry points beyond pom.xml. Start with the before-and-after pom.xml examples and determine how dependency and plugin versions should be represented as properties. Done means all applicable versions are declared in properties and their original version elements reference those properties.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.