GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Migrate GraalVM resource-config.json from regex to glob patterns by MBoegers · Pull Request #976 · openrewrite/rewrite-migrate-java

Conversation

@MBoegers

@MBoegers MBoegers commented Jan 27, 2026 •
edited by moderne-meeseeks Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Adds new recipe MigrateGraalVMResourceConfig to migrate GraalVM native-image resource-config.json files
  • Converts legacy regex pattern format (JDK 21 and earlier) to new glob pattern format (JDK 23+)
  • Includes declarative UpgradeToGraalVM23 recipe for easy discovery

Problem

GraalVM JDK 23 changed the resource hints syntax in resource-config.json from Java regex pattern format to glob pattern format. Applications using wildcards in their resource configurations need to update their registrations when upgrading to GraalVM 23+.

Old format (JDK 21 and earlier):

{
  "resources": {
    "includes": [{"pattern": ".*\\.txt"}],
    "excludes": [{"pattern": ".*\\.bak"}]
  }
}

New format (JDK 23+):

{
  "resources": [
    {"glob": "**/*.txt"}
  ]
}

Note: excludes is no longer supported in the new format.

Solution

The recipe:

  1. Detects old format resource-config.json files (with includes/excludes structure)
  2. Converts regex patterns to glob patterns:
    • .*\.txt → **/*.txt
    • [^/]* → *
    • META-INF/.* → META-INF/**
    • Escaped dots (\.) → literal dots (.)
  3. Restructures JSON from {resources: {includes: [...]}} to {resources: [...]}
  4. Removes excludes section (no longer supported)
  5. Marks patterns that cannot be automatically converted (character classes, alternations, etc.) with a SearchResult marker for manual review

Test plan

  • Existing tests pass

  • New tests added covering:

    • Simple pattern migration
    • Excludes removal
    • Single-level wildcard conversion ([^/]* → *)
    • Literal paths with escaped dots
    • Nested path wildcards
    • Non-resource-config files unchanged
    • Already-new format files unchanged
    • Unconvertible patterns marked for review
    • Module field preservation
  • Fixes moderneinc/customer-requests#1755

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@MBoegers
Migrate GraalVM resource-config.json from regex to glob patterns
6de7dbc
GraalVM JDK 23 changed the resource hints syntax in resource-config.json
from Java regex pattern format to glob pattern format. This recipe
automatically migrates the configuration files.

Changes:
- New recipe: MigrateGraalVMResourceConfig
- Converts pattern entries to glob entries (e.g., ".*\.txt" -> "**/*.txt")
- Restructures JSON from {resources: {includes: [...]}} to {resources: [...]}
- Removes excludes section (no longer supported in GraalVM 23+)
- Marks unconvertible patterns (character classes, alternations) for manual review

Fixes moderneinc/customer-requests#1755
@moderne-meeseeks moderne-meeseeks Bot added this to OpenRewrite Jan 27, 2026
@moderne-meeseeks moderne-meeseeks Bot assigned MBoegers Jan 27, 2026
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jan 27, 2026
github-actions[bot]
github-actions Bot reviewed Jan 27, 2026
View reviewed changes
Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfigTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfigTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfigTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfigTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/test/java/org/openrewrite/java/migrate/RegexToGlobConverterTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

MBoegers
MBoegers commented Jan 27, 2026
View reviewed changes
Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/RegexToGlobConverter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/RegexToGlobConverter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MBoegers
MBoegers marked this pull request as draft January 27, 2026 16:11
@MBoegers
Address PR review feedback
86565a4
- Update copyright year to 2026
- Use Tree.randomId() instead of UUID.randomUUID()
- Use ListUtils.map for more concise code
- Fix else-if code style (same line)
- Fix string comparison order ("**".equals(glob))
- Use defaults(RecipeSpec) pattern in tests
- Integrate RegexToGlobConverter into MigrateGraalVMResourceConfig
  (reducing public API surface per reviewer suggestion)
github-actions[bot]
github-actions Bot reviewed Jan 27, 2026
View reviewed changes
Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MBoegers
Address additional PR review feedback
34d2b97
- Convert getDisplayName/getDescription methods to String fields
- Use StringUtils.isNullOrEmpty() for null/empty check
- Add StringUtils import
github-actions[bot]
github-actions Bot reviewed Jan 27, 2026
View reviewed changes
Comment thread src/main/java/org/openrewrite/java/migrate/MigrateGraalVMResourceConfig.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@timtebeek timtebeek closed this Jan 27, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Jan 27, 2026
@timtebeek timtebeek reopened this Jan 27, 2026
@github-project-automation github-project-automation Bot moved this from Done to In Progress in OpenRewrite Jan 27, 2026
@timtebeek

timtebeek commented Jan 27, 2026

Copy link
Copy Markdown
Member

Apologies, had misread which repository this was.

MBoegers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MBoegers
apply OR BestPractices
81b5eae
@MBoegers
MBoegers marked this pull request as ready for review January 28, 2026 08:12
timtebeek
timtebeek reviewed Jan 28, 2026
View reviewed changes
Comment thread src/main/resources/META-INF/rewrite/graalvm.yml Outdated
- native-image
- java23
recipeList:
- org.openrewrite.java.migrate.MigrateGraalVMResourceConfig

@timtebeek timtebeek Jan 28, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just add this one recipe to the Java 25 upgrade? I don't see folks easily discover this one, nor do I see harm in including the recipe there. We have other JDK vendor specific migration recipes in there as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MBoegers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@MBoegers
include in MigrateGraalVMResourceConfig into Java 25 migration
8f8baa5
@MBoegers

MBoegers commented Jan 28, 2026

Copy link
Copy Markdown
Contributor Author

Build failure is resolves in #977

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MBoegers
Merge branch 'main' into jkschneider/graalvm-resource-config-glob
e439896
# Conflicts:
#	src/main/resources/META-INF/rewrite/java-version-25.yml
#	src/main/resources/META-INF/rewrite/recipes.csv
timtebeek
timtebeek approved these changes Jan 28, 2026
View reviewed changes
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Jan 28, 2026
@MBoegers
update recipes
e98bd3e
@MBoegers
MBoegers merged commit 4f3aaa0 into main Jan 28, 2026
2 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@MBoegers
MBoegers deleted the jkschneider/graalvm-resource-config-glob branch January 28, 2026 15:37
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jan 28, 2026
mergify Bot added a commit to robfrank/linklift that referenced this pull request Feb 14, 2026
@mergify
chore(deps): bump org.openrewrite.recipe:rewrite-migrate-java from 3.…
d6c64b2
…26.0 to 3.27.0 [skip ci]

Bumps [org.openrewrite.recipe:rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java) from 3.26.0 to 3.27.0.
Release notes

*Sourced from [org.openrewrite.recipe:rewrite-migrate-java's releases](https://github.com/openrewrite/rewrite-migrate-java/releases).*

> 3.27.0
> ------
>
> What's Changed
> --------------
>
> * Add jakarta.annotation-api dependency when using javax.annotation by [`@​jkschneider`](https://github.com/jkschneider) in [openrewrite/rewrite-migrate-java#972](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/972)
> * Add com.sun.istack.NotNull migration to Jakarta validation by [`@​jkschneider`](https://github.com/jkschneider) in [openrewrite/rewrite-migrate-java#973](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/973)
> * Add UseListOf and UseSetOf recipes by [`@​jkschneider`](https://github.com/jkschneider) in [openrewrite/rewrite-migrate-java#974](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/974)
> * Lombok Annotation Processor Configuration by [`@​MBoegers`](https://github.com/MBoegers) in [openrewrite/rewrite-migrate-java#977](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/977)
> * Migrate GraalVM resource-config.json from regex to glob patterns by [`@​MBoegers`](https://github.com/MBoegers) in [openrewrite/rewrite-migrate-java#976](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/976)
> * Followup after the formatting merge by [`@​Jenson3210`](https://github.com/Jenson3210) in [openrewrite/rewrite-migrate-java#978](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/978)
> * Avoid line continuation escapes in text blocks with mixed newline content by [`@​Jenson3210`](https://github.com/Jenson3210) in [openrewrite/rewrite-migrate-java#975](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/975)
> * Change Docker image version in Java upgrades by [`@​timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-migrate-java#980](https://redirect.github.com/openrewrite/rewrite-migrate-java/pull/980)
>
> **Full Changelog**: <openrewrite/rewrite-migrate-java@v3.26.0...v3.27.0>


Commits

* [`04592ca`](openrewrite/rewrite-migrate-java@04592ca) Expect continuation indent in text blocks
* [`f42714b`](openrewrite/rewrite-migrate-java@f42714b) Delete files
* [`9499e38`](openrewrite/rewrite-migrate-java@9499e38) [Auto] SDKMAN! Java candidates as of 2026-02-09T1052
* [`ca26543`](openrewrite/rewrite-migrate-java@ca26543) Change Docker image version in Java upgrades ([#980](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/980))
* [`6e525a1`](openrewrite/rewrite-migrate-java@6e525a1) Make declarative recipes singletons
* [`dc6029d`](openrewrite/rewrite-migrate-java@dc6029d) [Auto] SDKMAN! Java candidates as of 2026-02-02T1038
* [`e13f6e8`](openrewrite/rewrite-migrate-java@e13f6e8) Update documentation examples
* [`653dd7c`](openrewrite/rewrite-migrate-java@653dd7c) Add avoidLineContinuations option to UseTextBlocks ([#975](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/975))
* [`c6b1bcf`](openrewrite/rewrite-migrate-java@c6b1bcf) Followup after the formatting merge ([#978](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/978))
* [`4f3aaa0`](openrewrite/rewrite-migrate-java@4f3aaa0) Migrate GraalVM resource-config.json from regex to glob patterns ([#976](https://redirect.github.com/openrewrite/rewrite-migrate-java/issues/976))
* Additional commits viewable in [compare view](openrewrite/rewrite-migrate-java@v3.26.0...v3.27.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=org.openrewrite.recipe:rewrite-migrate-java&package-manager=maven&previous-version=3.26.0&new-version=3.27.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments
@timtebeek timtebeek timtebeek approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@MBoegers MBoegers

Labels

None yet

Projects

OpenRewrite
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@MBoegers @timtebeek
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.