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

--exclude-config native-image flag not working with the native-image Maven plugin #185

Closed
gradinac opened this issue Dec 20, 2021 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@gradinac
Copy link
Contributor

When creating the argument line for the native-image command, the classpath option (--cp <classpath>) is always put first. Native-image will process arguments in the order they appear on the command line (https://github.com/oracle/graal/blob/6e14dfe1d0d6c767eafaebe63b14192e36414a32/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java#L1555)
This means that the --cp option and all META-INF/native-image files on the classpath get processed before native-image sees the --exclude-config option and ignores them, effectively making the option a no-op

@sdeleuze
Copy link
Collaborator

sdeleuze commented Dec 20, 2021

To reproduce with Spring Native sample, for example webmvc-tomcat, add the following annotation to WebmvcApplication:

@NativeHint(options = {
		"--exclude-config foo.jar META-INF/native-image/.*"
})

I am wondering if this is a NBT bug or a native-image one. That said, fixing it on NBT side will be probably quicker.

@sdeleuze sdeleuze added this to the 0.9.10 milestone Dec 20, 2021
@sdeleuze sdeleuze added the bug Something isn't working label Dec 20, 2021
sdeleuze added a commit to spring-attic/spring-native that referenced this issue Dec 21, 2021
@sdeleuze
Copy link
Collaborator

sdeleuze commented Jan 6, 2022

See oracle/graal#3749 (comment) related comment where I ask a fix on GraalVM side since the issue is not limited to NBT.

@olpaw
Copy link
Member

olpaw commented Jun 13, 2022

@gradinac this should be fixed now with oracle/graal@006c61d
See also oracle/graal#3749 (comment)

@gradinac
Copy link
Contributor Author

@gradinac this should be fixed now with oracle/graal@006c61d
See also oracle/graal#3749 (comment)

Thank you very much for looking into this! :)
To support older GraalVM versions, @lazar-mitrovic has also added a field in the configuration of the gradle plugin that allows specifying --exclude-config which always gets put before the -cp options for the native-image-builder.
As this has been fixed on both the native-image side and the NBT side, I'll close this issue

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

4 participants