-
Notifications
You must be signed in to change notification settings - Fork 127
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
[MRESOLVER-442] Build JDK transport MR JAR the proper way #381
Conversation
The current master builds JAR that it is not reusable in any project that uses enforcer (like Maven is). Make JAR "java 8" and let other (higher) byte classes get into their proper place. --- https://issues.apache.org/jira/browse/MRESOLVER-442
This is the ONLY option that produces "clean" Java8 artifact usable in downstream projects that use enforcer (like Maven is). Moreover, Maven for example sets the bar low, is Java8, so even if I "hack" something here like you propose, hack will need to be carried over (as hack usually pulls more hacks) downstream to exclude Java11 JAR from enforcement etc... So, IMO this is the best solution as:
|
Once again, this is due to an enforcer bug so a not really a point.
I explained you it does if you limit the downstream consumers to maven, you said it was not the case (agree on that) so it does NOT work.
No hack needed with all in one and mjar-free option too, only enforcer can throw a false positive and it is trivial to solve so.
Literally the opposite I'm quite lost cause you explain the best solution is exactly what you don't reach with mjar.. |
Unsure which "enforcer bug" you refer to... all it does when you ask enforcer "I don't want any higher bytecode on classpath than Java8" is to fail when it encounters Java11 bytecode with your solution, as it really does contain Java11 classes on Java 8 classpath. So, unsure where the bug is? It does work, as PR shows. Can you show me example where it does not work? As I said above, if JAR is Java11 and you want to use it downstream in project that declares itself java 8, it is "enforcer bug" according to you, that enforcer fails the build in this case? For this no hacks (as those are like static electricity, the more you have of those, the more you need downstream) and "bugs" needed, it just works. Clear, simple. |
Enforcer ignores mjar as of today and its validation can be wrong in some cases (here you want to enforce java 8 bytecode at build time but you enables java 11 bytecode, so this shouldn't pass with this configuration, should only pass saying "i want java 8 bytecode and I tolerate higher bytecode in META-INF/versions).
Gave you severals, just use a classloader loading classes from anywhere else than a zip/jar - including resolver, it is the most trivial case. Run on java 11 and see the unexpected exception. |
That's not what happens, please check out the code.
Just enable sisu debug and use Java8 and watch your screen become full of errors as Sisu scans the classpath. With this solution when running on Java8 there is 0 errors logged. |
My POV: BUT: if some dependency has a multi-release-jar with additional support for newer java versions, then this is also perfectly fine as long as it can execute on the requested jvm version. |
@cstamas these are two ok things:
@struberg literally means that so overall multi jar release is always pointless and it is better to stay away from it due to the downsides mentionned earlier. I have really a hard time to see why jumping on a feature which breaks the library nature of the project is good since technically there is nothing which can explain it. |
you mean you have additional classes which will get picked up dynamically by the app only if you run on a jvm which is suitable? I've seen this done, yes, but that cries for an exclude in m-enforcer-plugin or some other trick. |
@struberg yep. Agree it needs some tuning of m-enforcer-plugin but isnt it the case anyway? |
The current master builds JAR that it is not reusable in any project that uses enforcer (like Maven is).
Make JAR "java 8" and let "java 11" byte classes get into their proper place.
https://issues.apache.org/jira/browse/MRESOLVER-442