Skip to content

Conversation

@vaslabs
Copy link
Contributor

@vaslabs vaslabs commented Jan 8, 2026

Motivation

Fixes #6534

Fixes micronaut native image generation (on basic examples) by honouring the override configurations and using a better alternative (-H:ConfigurationFileDirectories=) to pass the reachability metadata configs.

For a more detailed explanation see this issue

Solution

Reachability metadata may provide override flags. These suggest that something needs to take precedence over something else. I didn't find a direct recommendation in any of the docs, but, I pulled out the native-image command gradle uses and found 6 --exclude-config flags on 6 netty artifacts.

After some trial and error, I replicated the result using this override logic. For more information on the reverse engineering part see my comment here

Micronaut

Micronaut, also has AOT. I focused on the GraalVM support in this PR, so I haven't added direct support to Micronaut's AOT yet. But I've provided an example, which shows how it can be added by the user.

A future PR may provide a similar module to SpringBootModule with all the utilities given out of the box.

I haven't added much in this example yet, just that it builds.

Manual test:

image

I have also added support for including application resources in the native image from the module itself (ref: https://www.graalvm.org/22.1/reference-manual/native-image/Resources/)

Other fixes

With the changes to fetch artifacts, the kotlin native fails due to ignoring the resolution parameters. A fix was added in the coursier module to pass resolutionParams on.

@autofix-ci
Copy link
Contributor

autofix-ci bot commented Jan 8, 2026

Hi! I'm autofix logoautofix.ci, a bot that automatically fixes trivial issues such as code formatting in pull requests.

I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:

  1. Allow edits by maintainers for your pull request, and then re-trigger CI (for example by pushing a new commit).
  2. Manually fix the issues identified for your pull request (see the GitHub Actions output for details on what I would like to change).

@vaslabs vaslabs marked this pull request as ready for review January 8, 2026 17:57
@vaslabs
Copy link
Contributor Author

vaslabs commented Jan 9, 2026

CI failure seems flakiness due to IO

Ready for a review @lihaoyi @lefou

@vaslabs vaslabs changed the title GraalVM: Honors the reachability metadata override flags by excluding configs inside dependency artifacts GraalVM: Honor the reachability metadata override flags by excluding configs inside dependency artifacts Jan 9, 2026
@@ -0,0 +1,160 @@
package build
Copy link
Member

Choose a reason for hiding this comment

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

This should be referenced on the javalib/web.adoc page

@vaslabs
Copy link
Contributor Author

vaslabs commented Jan 9, 2026

  • also fixing a few image option issues + fixing the resources not included in native image

@vaslabs vaslabs marked this pull request as draft January 9, 2026 16:47
@vaslabs vaslabs force-pushed the native-graalvm-config-fixes branch from a65f9da to 9e7e306 Compare January 9, 2026 16:52
@vaslabs vaslabs marked this pull request as ready for review January 9, 2026 18:04
deps0.map(_.dep),
sources = sources,
ctx = Some(ctx),
resolutionParams = resolutionParams,
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a bug fix. Could you mention it in the PR description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@lihaoyi lihaoyi merged commit 117f041 into com-lihaoyi:main Jan 11, 2026
42 of 44 checks passed
@lefou lefou deleted the native-graalvm-config-fixes branch January 11, 2026 10:00
@lefou lefou added this to the 1.1.0-RC4 milestone Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GraalVM: Exclude native image configurations from jars if they are found in reachability metadata

3 participants