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
Invalid module descriptor of byte-buddy jar
when JAVA_HOME
is set to version 21
#1598
Comments
The plugin to generate the module-info works as expected, but indeed, ASM does not reproduce the packages that are provided to it when reading the generated module-info. I will look into it! |
It seems like the |
This seems to be related to the "jar" tool. With Java 8, everything works. The |
I did test the |
This seems to be related to the "jar" tool. With Java 8, everything works. The I find this behaviour rather surprising but I assume that I need to specify something on the command line. I will investigate. |
Turns out that the jar tool processes the package attribute of a module-info when placing it in a jar and removes all packages that are not contained. This breaks here since the shade plugin is adding class files later from a different location which is not present when the jar is first assembled. As a result, the module-info is incomplete. This does of course not happen with Java 8 as it is not aware of the module-info. Strange feature of the jar tool, I say, but I worked around it by injecting the module-info class into the jar file now after the jar tool is used. I had to make some tweaks to the (my) plugin to support reproducible builds what did not work before, but this works now. |
Can you try master now? |
Simple check worked for me, I didn't check the initial failure (byte-buddy couldn't be used as a modular dependency when bootstrapping Maven with JDK 21, that takes some time to do). |
Do you have an idea why this problem manifests with JDK 21? I can only think of natural code changes to the |
Java 17 does not validate this aspect of a module info. Seems like that code was introduced in Java 20 and not backported. |
With the backported changes to modulemaker and byte-buddy I was able to bootstrap Maven. By the way, have you considered using a more standard approach to adding a |
When I added the plugin there was nothing really, but I am happy to revisit. Do you know of a good option? I do however wonder if they work with the shade plugin then. |
Ah right, shade plugin, i don't really know what it does, we always remove it from our packages before our builds. |
And repackages. ASM did some major. API changes in the past, thus the repackaging. |
So, first thing that comes to my mind is to have a |
The problem being is that I want to create the same jar with all toolchains from Java 6 upwards. With my plugin this is possible, but but I did not find other ways of doing it. |
On Fedora 38.
Build the project using Maven.
Check the module info of the compiled
jar
:This does not happen when using Java 17.
The text was updated successfully, but these errors were encountered: