You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an old leak which triggered a lot of regressions and still triggers bugs in mojos.
Since there is on real justification in maven itself (@Typed is not since there are alternative and cdi is not used in any piece of maven), let's drop it.
If a plugin needs it, it already has it since cdi-api is outdated anyway.
Michael Osipov tomee, meecrowave, weld, camel-cdi, quarkus in some context/config, exec-maven-plugin in java mode, all will fail to use CDI 2 API properly (Instance will not have stream() support for example since it was not in 1.1). Indeed upgrading to cdi-api 2.0 is a workaround in maven but since maven does NOT need this dependency and it creates issue with all implementation there is no point to try to keep it. This always had been a bug and was reported years ago, we were just too slow to fix it - blame me because I guess I was one of the first to face it. Indeed some applications not using overlapping features will run properly but this is still a bug. Also leaking API not provided is another bug (why do we export javax.enterprise and not use it at all except @Typed from memory which is not even needed. Indeed if you have another fix i'm fine with it but I think it is the simplest and less breaking fix to that old bug.
Thank your for the explanation. Does it make sense from your POV to create an IT which shows the failure and then fixed by your change with Maven 4.0.0? That'd be awesome.
Michael Osipov well, if it is a prerequisite to merge I'll do but it is not CDI specific, this is why Mark said maven shouldn't leak any library except org.apache.maven (or its core backbone) so it is kind of already tested with exportedpackage tests, here the configuration was just wrong. This is why I didn't add a test. Let me know if I must add one or if we are fine with our current coverage.
side note: same issue applies to jsr250 but since it didnt move we don't hit it as easily ;)
The IT is not a prerequisite. It would be nice to be able to demonstrate the failure. I am not able to create such an IT since I don't have the knowledge about the frameworks you have.
I actually use JSR 250 in a Maven Resolver component to override a default one with {{@Priority}.
I will leave it up to you whether you can/are able to provide an IT. I would be greatful, but won't insist.
if you run "mvn process-classes" it fails on 3.6.3 and works on 4.0.0-alpha-1-SNAPSHOT.
The point is that as soon as you add decorator/interceptor, reflection will occur similarly to this main - this is why i dont even start a full container and just do a reflection check to ensure it uses the api specified in dependency.
It happens for plugin using ClassRealm as parent classloader of the runtime one (so exec one can be safe in several cases but not 100%) with the default parent first strategy.
Activity
jira-importer commentedon Dec 3, 2020
Michael Osipov commented
Can you point to a few explicit bugs? I can't remember someone has ever reported something.
jira-importer commentedon Dec 3, 2020
Mark Struberg commented
+1 I was opposed to even the atinject and slf4j apis back then. Maven should imo be fully self-contained without any classpath conflicts.
jira-importer commentedon Dec 4, 2020
Romain Manni-Bucau commented
Michael Osipov tomee, meecrowave, weld, camel-cdi, quarkus in some context/config, exec-maven-plugin in java mode, all will fail to use CDI 2 API properly (Instance will not have stream() support for example since it was not in 1.1). Indeed upgrading to cdi-api 2.0 is a workaround in maven but since maven does NOT need this dependency and it creates issue with all implementation there is no point to try to keep it. This always had been a bug and was reported years ago, we were just too slow to fix it - blame me because I guess I was one of the first to face it. Indeed some applications not using overlapping features will run properly but this is still a bug. Also leaking API not provided is another bug (why do we export javax.enterprise and not use it at all except
@Typedfrom memory which is not even needed. Indeed if you have another fix i'm fine with it but I think it is the simplest and less breaking fix to that old bug.jira-importer commentedon Dec 4, 2020
Michael Osipov commented
Thank your for the explanation. Does it make sense from your POV to create an IT which shows the failure and then fixed by your change with Maven 4.0.0? That'd be awesome.
jira-importer commentedon Dec 4, 2020
Romain Manni-Bucau commented
Michael Osipov well, if it is a prerequisite to merge I'll do but it is not CDI specific, this is why Mark said maven shouldn't leak any library except org.apache.maven (or its core backbone) so it is kind of already tested with exportedpackage tests, here the configuration was just wrong. This is why I didn't add a test. Let me know if I must add one or if we are fine with our current coverage.
side note: same issue applies to jsr250 but since it didnt move we don't hit it as easily ;)
jira-importer commentedon Dec 4, 2020
Michael Osipov commented
The IT is not a prerequisite. It would be nice to be able to demonstrate the failure. I am not able to create such an IT since I don't have the knowledge about the frameworks you have.
I actually use JSR 250 in a Maven Resolver component to override a default one with {{
@Priority}.I will leave it up to you whether you can/are able to provide an IT. I would be greatful, but won't insist.
jira-importer commentedon Dec 4, 2020
Romain Manni-Bucau commented
Ok, here is a small reproducer:
if you run "mvn process-classes" it fails on 3.6.3 and works on 4.0.0-alpha-1-SNAPSHOT.
The point is that as soon as you add decorator/interceptor, reflection will occur similarly to this main - this is why i dont even start a full container and just do a reflection check to ensure it uses the api specified in dependency.
It happens for plugin using ClassRealm as parent classloader of the runtime one (so exec one can be safe in several cases but not 100%) with the default parent first strategy.
jira-importer commentedon Dec 22, 2020
Michael Osipov commented
Fixed with 2609cdcbc08a053bf508a657201c2dba657bced7 and 2b142fde24ff73c1a4ce654708fd868c97e1499e.
jira-importer commentedon Sep 16, 2021
Michael Osipov commented
Fixed with 93f9e85955abb40bb090bad689f15fa9969ef9ba in 3.8.x.