-
Notifications
You must be signed in to change notification settings - Fork 143
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
Modulith together with Gradle 'org.graalvm.buildtools.native' plugin causes strange problems #401
Comments
This seems to be caused by the compilation of the AOT generated code not seeing dependencies of scope |
Running
Looking at the
Converting the sample to Java fixes this compilation problem and we see a test failure instead:
The compilation failure has been fixed because
If the Kotlin plugins are then applied again, but the code is left as Java, the compilation problem returns because I think the compilation problem is a bug in Kotlin's Gradle plugins that will need to be fixed by JetBrains. |
I filed a ticket with the Kotlin team. |
Closing this as there's nothing we can do about this here. |
Is there something to be done for the test failure that occurs with Java? The AOT processing seems to "corrupt" the state of the module such that the constraints are violated:
|
In fact, there is. I didn't see that originally, as I assumed it'd be an intended violation. I think the culprit here is that the generated With manually written code this usually works well or at least can be worked around by configuration code in the application root package referring to an interface, gathering all beans of that type and the implementations hidden in the modules then implementing that interface. I wonder if it makes sense to exclude the AOT generated files from the analysis. It looks like they all feature a double underscore in their classnames. Until we find a better means of identifying them, it might be a good enough way of detecting them? Do you think we could annotate these classes with A quick spike adding the ignore of types containing a |
Yes, I think it does.
Sounds reasonable to me given what's currently available.
WDYT, @snicoll? There's also |
Alright, with this being the second case for us to do this, I've triaged the existing issue and put a higher priority on it, see spring-projects/spring-framework#30824 At face value, I am not a huge fan of using any of those annotations but we can discuss the pros and cons of a custom annotation of ours in the issue. Thanks! |
I have encountered a strange bug that made the modules.verify() always fail is there is a Spring component in an internal package, even if it is not used by another module, even for very simple Spring Boot applications.
My main development language is Kotlin with Gradle + Kotlin DSL. But I believe this also happens in Java. The issue seems to be with Gradle… maybe with the org.graalvm.buildtools.native plugin for gradle.
When using this plugin AND an application contextLoads() test, the modules.verify() test tails. Either removing the contextLoads() test or removing the native Plugin makes the test pass.
I struggle to understand how this happens, as I thought the plugin would only do thing when doing native builds.
I tried the same setup with Maven + Java and could not reproduce this bug.
Here is a minimal example project where you can test this behavior: https://github.com/dragetd/temp_modulith_graal_bug/tree/main
The text was updated successfully, but these errors were encountered: