Skip to content

add ExtractVersionsAsProperties recipe#7655

Open
barbulescu wants to merge 8 commits into
openrewrite:mainfrom
barbulescu:extract-maven-versions-as-properties
Open

add ExtractVersionsAsProperties recipe#7655
barbulescu wants to merge 8 commits into
openrewrite:mainfrom
barbulescu:extract-maven-versions-as-properties

Conversation

@barbulescu
Copy link
Copy Markdown
Contributor

@barbulescu barbulescu commented May 12, 2026

What's changed?

Add ExtractVersionsAsProperties recipe and tests.

What's your motivation?

Extract versions as properties in pom.xml.

Anything in particular you'd like reviewers to focus on?

I tried to make the code as clean as possible while still following project style.

Anyone you would like to review specifically?

Claude Code was used in small TDD iterations with manual review after each step.

Have you considered any alternatives or workarounds?

not aware of any

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 12, 2026
@timtebeek timtebeek self-requested a review May 12, 2026 21:38
@barbulescu barbulescu force-pushed the extract-maven-versions-as-properties branch 2 times, most recently from 2340fd5 to f9c1002 Compare May 14, 2026 07:51
@barbulescu
Copy link
Copy Markdown
Contributor Author

@timtebeek is the build failure caused by my change?

I increased temporarly log verbosity and I see this error:

2026-05-14T07:56:20.3028459Z         Caused by:
2026-05-14T07:56:20.3055043Z         org.openrewrite.maven.MavenDownloadingException: org.springframework.integration:spring-integration-bom:5.5.0 failed. Unable to download POM: org.springframework.integration:spring-integration-bom:5.5.0. Tried repositories:
2026-05-14T07:56:20.3119038Z         https://artifactory.moderne.ninja/artifactory/moderne-cache-3/: HTTP 401

I also get locally HTTP 429 from Maven Central repo but my tests are green.

@timtebeek
Copy link
Copy Markdown
Member

Hi thanks; no that's new unfortunately, unrelated to your changes. It seems like they're setting limits on calls to Maven Central, and we added an in between cache that doesn't work well on forks just yet. Working out the details still, but flying home from Code Remix Summit first. :)

Thanks for the work here! Seems like a neat addition for our Maven best practices as well. Did you already run it there with success?

@barbulescu barbulescu force-pushed the extract-maven-versions-as-properties branch from 4e82054 to 46d5426 Compare May 16, 2026 20:08
@barbulescu
Copy link
Copy Markdown
Contributor Author

Hi thanks; no that's new unfortunately, unrelated to your changes. It seems like they're setting limits on calls to Maven Central, and we added an in between cache that doesn't work well on forks just yet. Working out the details still, but flying home from Code Remix Summit first. :)

Thanks for the work here! Seems like a neat addition for our Maven best practices as well. Did you already run it there with success?

I tried on AssertJ project with changes been done correctly:

[INFO] Using active recipe(s) [org.openrewrite.maven.ExtractVersionsAsProperties]
[INFO] Using active styles(s) []
[INFO] Validating active recipes...
[INFO] Project [AssertJ Build] Resolving Poms...
[INFO] Project [AssertJ Build] Parsing source files
[INFO] Project [AssertJ (Bill of Materials)] Parsing source files
[INFO] Project [AssertJ Parent] Parsing source files
[INFO] Project [AssertJ Core] Parsing source files
[WARNING] There were problems parsing some source files, run with --errors to see full stack traces
[WARNING] There were problems parsing assertj-core/src/main/java/org/assertj/core/api/AbstractIterableAssert.java
[INFO] Project [AssertJ Guava] Parsing source files
[INFO] Project [AssertJ Tests] Parsing source files
[INFO] Project [AssertJ Integration Tests] Parsing source files
[INFO] Project [AssertJ Core Integration Tests (OSGi)] Parsing source files
[INFO] Project [AssertJ Core Integration Tests (Spring Boot)] Parsing source files
[INFO] Project [AssertJ Core Integration Tests] Parsing source files
[INFO] Project [AssertJ Guava Integration Tests] Parsing source files
[INFO] Project [AssertJ Core Integration Tests (Groovy)] Parsing source files
[INFO] Project [AssertJ Core Integration Tests (Kotlin)] Parsing source files
[INFO] Project [AssertJ Scripts Integration Tests] Parsing source files
[INFO] Project [AssertJ Performance Tests] Parsing source files
[INFO] Running recipe(s)...
[WARNING] Changes have been made to pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-parent/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-core/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-tests/assertj-integration-tests/assertj-core-osgi/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-tests/assertj-integration-tests/assertj-core-spring-boot/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-tests/assertj-integration-tests/assertj-core-tests/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-tests/assertj-integration-tests/assertj-guava-tests/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-tests/assertj-integration-tests/assertj-core-groovy/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Changes have been made to assertj-tests/assertj-integration-tests/assertj-core-kotlin/pom.xml by:
[WARNING]     org.openrewrite.maven.ExtractVersionsAsProperties
[WARNING] Please review and commit the results.
[WARNING] Estimate time saved: 45m
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for AssertJ Build 4.0.0-SNAPSHOT:

and build successful after changes.

There is a small improvement but I will do it on a further PR - move duplicate properties into root pom.xml.

@barbulescu
Copy link
Copy Markdown
Contributor Author

@timtebeek in relation to "I've used the IntelliJ IDEA auto-formatter on affected files", I recall that I saw somewhere that Eclipse formatter plugin must be used, but I don't find this reference or how to set up it correctly.

@timtebeek
Copy link
Copy Markdown
Member

hey thanks no the default IntelliJ formatter is what we all use. Still hoping to get to your PR, but it's been awfully good weather over the weekend for hikes. ;)
Thanks again for the work son far! Good to know the recipe already works, and indeed a separate recipe to pull up shared properties into a parent could be best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants