Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard resource pattern doesn't work with Gradle plugin #639

Open
Skater901 opened this issue Nov 18, 2024 · 2 comments
Open

Wildcard resource pattern doesn't work with Gradle plugin #639

Skater901 opened this issue Nov 18, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Skater901
Copy link

Before reporting

  • This repository should be used to report issues on the Maven or Gradle plugins for GraalVM.
  • Please report issues which are specific to the Spring Framework or the Micronaut framework to their specific repositories.
  • Do not report issues with building your specific application, e.g errors which happen at image build time like classes initialized at build time, or missing classes as run time: those are not related to the plugins but problems with configuration. You can refer to the GraalVM native image documentation for available options and the plugins documentation for how to use them with the plugin.

Describe the bug
When trying to include resources from a Jar in the project dependencies, using a wild card pattern doesn't work to include the files. Only specifying the files explicitly by name ensures they are included in the native image.
Make sure that you have read the documentation and that you are using the latest plugin version.

To Reproduce

A reproducible example can be found here

Steps to reproduce the behavior:

dependencies {
    implementation("org.webjars:swagger-ui:5.17.11")
}

graalvmNative {
    binaries.named("main") {
        resources.includedPatterns.add("META-INF/resources/webjars/swagger-ui/5.17.11/*")
    }
}
$ ./gradlew nativeCompile
$ ./build/native/nativeImage/{binary-name}

Please use backticks to properly format code.
If possible please attach a complete reproducer here (either as a zip file or as a link to public repository/branch).

Expected behavior
All files in the META-INF/resources/webjars/swagger-ui/5.17.11 folder from the org.webjars:swagger-ui:5.17.11 library should be included in the produce native image.

Logs
Add logs to help explain your problem.
Please use backticks to properly format big logs. Example:

```
[thread:1] scope: main
  [thread:1] scope: main.registerResource
  ResourcesFeature: registerResource: java.base:java/lang/uniName.dat
  [thread:1] scope: main.registerResource
  ResourcesFeature: registerResource: META-INF/resources/webjars/swagger-ui/5.17.11
```

System Info (please complete the following information):

  • OS: Windows 10
  • GraalVM Version Oracle GraalVM 21.0.5+9.1
  • Java Version 21.0.5+9-LTS
  • Plugin version id("org.graalvm.buildtools.native") version "0.10.3"

Additional context
Add any other context about the problem here.

@Skater901 Skater901 added the bug Something isn't working label Nov 18, 2024
@dnestoro
Copy link
Collaborator

@melix are you familiar with this way of registering resources:

graalvmNative {
    binaries.named("main") {
        resources.includedPatterns.add("META-INF/resources/webjars/swagger-ui/5.17.11/*")
    }
}

@Skater901
Copy link
Author

I forgot to include the documentation I was looking at: https://www.graalvm.org/latest/reference-manual/native-image/metadata/#resource-metadata-in-json

For what it's worth, the docs for GraalVM for JDK 21 (which is what I'm using) don't talk about using wildcards, but they do include examples of patterns with wildcards: https://www.graalvm.org/jdk21/reference-manual/native-image/metadata/#resource-metadata-in-json

I'm assuming these docs are applicable to the Gradle plugin, but if they're not, then this could simply be a case of insufficient documentation for the Gradle plugin, and I haven't correctly configured the resource inclusion pattern for the Gradle plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants