You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tamás Cservenák <ta...@cservenak.net> on 2023/10/16 18:45:28 UTC
Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Howdy,
This mail is just a general response (initiated by those asking me in
private): it seems that the Maven team "forgot" to emphasize an important
question on the Maven site, while it is becoming more and more pressing,
especially as Java 17 is out long time ago, and Java 21 is here as well.
In short: if you develop Java Mojo (a Maven plugin), that you plan to use
with current "stable" Maven versions (3.9.x and maybe 3.8,x), your
maven-plugin packaged artifact MUST NOT use Java bytecode that is newer
than Java 14!
What happens is that Eclipse Sisu is unable to inspect the component
class/bytecode 14+ in question (despite is listed on index, in
META-INF/sisu/javax.inject.Named file), and it will silently ignore the
component, "pretend" like it's absent (and error reported will be like
Guice does not find the component to be injected). This can be seen, if you
make Sisu DEBUG (-Dsisu.debug on maven cli).
Cause of limitation is the version of Eclipse Sisu used in Maven (the
JSR330 container implementation Maven uses internally), see
https://github.com/eclipse/sisu.inject/issues/94. Eclipse Sisu versions
0.3.5 (used in Maven 3.8.x and 3.9.x) uses ASM that is able to scan
bytecode only up to Java 14. Latest release 0.9.0.M2 (used in Maven4) is
covering this up to Java21, while this issue above should fully cover, and
will probably be updated in Maven4 once released.
So, for plugin devs targeting Maven3, best is to not exceed Java 14 (safest
Java11) bytecode version for components (Mojos and JSR330 components).
HTH
Tamas
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Tamás Cservenák <ta...@cservenak.net>.
Yes, I agree.
Created https://issues.apache.org/jira/browse/MNG-7913
On Tue, Oct 17, 2023 at 4:31 PM Konrad Windszus <kw...@apache.org> wrote:
> I think we should revise the decision to not backport
> https://issues.apache.org/jira/projects/MNG/issues/MNG-7587 <
> https://issues.apache.org/jira/projects/MNG/issues/MNG-7587?filter=reportedbyme>
> to Maven 3.9.x…
>
> > On 16. Oct 2023, at 22:08, Garret Wilson <ga...@globalmentor.com>
> wrote:
> >
> > On 10/16/2023 4:59 PM, Tamás Cservenák wrote:
> >> You'd use Plexus? In 2023?
> >
> > I don't know what I'd use. I'm asking. I haven't written a Maven plugin
> yet. I'm just reading the latest documentation, and the [Plugin Developers
> Centre](https://maven.apache.org/plugin-developers/) seems to say at
> https://maven.apache.org/maven-jsr330.html that I either have to use
> Plexus or JSR-330, and you just told me I can't use JSR-330, so that leaves
> Plexus.
> >
> > If I'm not understanding the documentation correctly, please point out
> what I'm missing.
> >
> >> …
> >> In other words: whatever is "managed by sisu, should be max Java 14"
> >> bytecode in current release Maven versions. Naturally, this does NOT
> apply
> >> to ANY code, just those being JSR330 (and Mojo) annotated.
> >
> > Maybe you are saying I can write a Maven plugin without using Plexus or
> JSR-330? So dependency injection in Maven Plugins is optional? The page at
> https://maven.apache.org/maven-jsr330.html makes it seem like dependency
> injection in a Maven Plugin is a common thing.
> >
> > (Maybe your announcement makes perfect sense to those who have written
> Maven plugins before. In the meantime I'm reading the online documentation
> and trying to understand how this will affect me once I write a plugin.)
> >
> > Garret
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
>
>
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Konrad Windszus <kw...@apache.org>.
I think we should revise the decision to not backport https://issues.apache.org/jira/projects/MNG/issues/MNG-7587 <https://issues.apache.org/jira/projects/MNG/issues/MNG-7587?filter=reportedbyme> to Maven 3.9.x…
> On 16. Oct 2023, at 22:08, Garret Wilson <ga...@globalmentor.com> wrote:
>
> On 10/16/2023 4:59 PM, Tamás Cservenák wrote:
>> You'd use Plexus? In 2023?
>
> I don't know what I'd use. I'm asking. I haven't written a Maven plugin yet. I'm just reading the latest documentation, and the [Plugin Developers Centre](https://maven.apache.org/plugin-developers/) seems to say at https://maven.apache.org/maven-jsr330.html that I either have to use Plexus or JSR-330, and you just told me I can't use JSR-330, so that leaves Plexus.
>
> If I'm not understanding the documentation correctly, please point out what I'm missing.
>
>> …
>> In other words: whatever is "managed by sisu, should be max Java 14"
>> bytecode in current release Maven versions. Naturally, this does NOT apply
>> to ANY code, just those being JSR330 (and Mojo) annotated.
>
> Maybe you are saying I can write a Maven plugin without using Plexus or JSR-330? So dependency injection in Maven Plugins is optional? The page at https://maven.apache.org/maven-jsr330.html makes it seem like dependency injection in a Maven Plugin is a common thing.
>
> (Maybe your announcement makes perfect sense to those who have written Maven plugins before. In the meantime I'm reading the online documentation and trying to understand how this will affect me once I write a plugin.)
>
> Garret
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Garret Wilson <ga...@globalmentor.com>.
On 10/16/2023 4:59 PM, Tamás Cservenák wrote:
> You'd use Plexus? In 2023?
I don't know what I'd use. I'm asking. I haven't written a Maven plugin
yet. I'm just reading the latest documentation, and the [Plugin
Developers Centre](https://maven.apache.org/plugin-developers/) seems to
say at https://maven.apache.org/maven-jsr330.html that I either have to
use Plexus or JSR-330, and you just told me I can't use JSR-330, so that
leaves Plexus.
If I'm not understanding the documentation correctly, please point out
what I'm missing.
> …
> In other words: whatever is "managed by sisu, should be max Java 14"
> bytecode in current release Maven versions. Naturally, this does NOT apply
> to ANY code, just those being JSR330 (and Mojo) annotated.
Maybe you are saying I can write a Maven plugin without using Plexus or
JSR-330? So dependency injection in Maven Plugins is optional? The page
at https://maven.apache.org/maven-jsr330.html makes it seem like
dependency injection in a Maven Plugin is a common thing.
(Maybe your announcement makes perfect sense to those who have written
Maven plugins before. In the meantime I'm reading the online
documentation and trying to understand how this will affect me once I
write a plugin.)
Garret
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Tamás Cservenák <ta...@cservenak.net>.
You'd use Plexus? In 2023?
Please no :)
TL;DR: Plexus shim (used in Maven, more specifically
https://github.com/eclipse/sisu.plexus) builds atop of sisu.inject project,
so the same thing applies.
In other words: whatever is "managed by sisu, should be max Java 14"
bytecode in current release Maven versions. Naturally, this does NOT apply
to ANY code, just those being JSR330 (and Mojo) annotated.
HTH
T
On Mon, Oct 16, 2023 at 9:49 PM Garret Wilson <ga...@globalmentor.com>
wrote:
> On 10/16/2023 4:36 PM, Tamás Cservenák wrote:
> > …
> >
> > no, this applies to "sisu managed components" ONLY. So not ALL the code
> > needs to be downgraded, only those annotated with JSR330 annotations.
>
> After reading and trying to understand
> https://maven.apache.org/maven-jsr330.html , does this mean I'll have to
> use the old-style [Plexus
> annotations](
> https://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/),
>
> and then just convert to JSR-330 once Maven updates Sisu?
>
> In other words, if I use Plexus annotations I'll be fine with Java 17,
> and have no limitations or problems from not using JSR-330 annotations?
>
> Garret
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Garret Wilson <ga...@globalmentor.com>.
On 10/16/2023 4:36 PM, Tamás Cservenák wrote:
> …
>
> no, this applies to "sisu managed components" ONLY. So not ALL the code
> needs to be downgraded, only those annotated with JSR330 annotations.
After reading and trying to understand
https://maven.apache.org/maven-jsr330.html , does this mean I'll have to
use the old-style [Plexus
annotations](https://codehaus-plexus.github.io/plexus-containers/plexus-component-annotations/),
and then just convert to JSR-330 once Maven updates Sisu?
In other words, if I use Plexus annotations I'll be fine with Java 17,
and have no limitations or problems from not using JSR-330 annotations?
Garret
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Garret Wilson <ga...@globalmentor.com>.
Tamás, thank you very much for the clarification. The previous
announcement sounded like it applied to every Maven plugin.
Garret
On 10/16/2023 4:36 PM, Tamás Cservenák wrote:
> Hej Garret,
>
> no, this applies to "sisu managed components" ONLY. So not ALL the code
> needs to be downgraded, only those annotated with JSR330 annotations.
> And yes, Maven 3.9.6 could upgrade Sisu to the latest version, basically
> lifting this limitation.
>
> HTH
> T
>
> On Mon, Oct 16, 2023 at 9:19 PM Garret Wilson <ga...@globalmentor.com>
> wrote:
>
>> Wait, really? I have an annotation processor being developed now with
>> Java 17, and parts of it soon will need to move to a Maven plugin. This
>> means that I'll have to downgrade all the code to Java 14?? In 2023?
>>
>> Are there any workarounds? The issue #94 you mentioned has already been
>> closed as addressed. Are you saying that Sisu 0.9.0.M2 fixes the
>> problem? Can't Maven 3.x simply upgrade to that and release v3.9.6?
>>
>> Garret
>>
>> On 10/16/2023 3:45 PM, Tamás Cservenák wrote:
>>> Howdy,
>>>
>>> This mail is just a general response (initiated by those asking me in
>>> private): it seems that the Maven team "forgot" to emphasize an important
>>> question on the Maven site, while it is becoming more and more pressing,
>>> especially as Java 17 is out long time ago, and Java 21 is here as well.
>>>
>>> In short: if you develop Java Mojo (a Maven plugin), that you plan to use
>>> with current "stable" Maven versions (3.9.x and maybe 3.8,x), your
>>> maven-plugin packaged artifact MUST NOT use Java bytecode that is newer
>>> than Java 14!
>>>
>>> What happens is that Eclipse Sisu is unable to inspect the component
>>> class/bytecode 14+ in question (despite is listed on index, in
>>> META-INF/sisu/javax.inject.Named file), and it will silently ignore the
>>> component, "pretend" like it's absent (and error reported will be like
>>> Guice does not find the component to be injected). This can be seen, if
>> you
>>> make Sisu DEBUG (-Dsisu.debug on maven cli).
>>>
>>> Cause of limitation is the version of Eclipse Sisu used in Maven (the
>>> JSR330 container implementation Maven uses internally), see
>>> https://github.com/eclipse/sisu.inject/issues/94. Eclipse Sisu versions
>>> 0.3.5 (used in Maven 3.8.x and 3.9.x) uses ASM that is able to scan
>>> bytecode only up to Java 14. Latest release 0.9.0.M2 (used in Maven4) is
>>> covering this up to Java21, while this issue above should fully cover,
>> and
>>> will probably be updated in Maven4 once released.
>>>
>>> So, for plugin devs targeting Maven3, best is to not exceed Java 14
>> (safest
>>> Java11) bytecode version for components (Mojos and JSR330 components).
>>>
>>> HTH
>>> Tamas
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Tamás Cservenák <ta...@cservenak.net>.
Hej Garret,
no, this applies to "sisu managed components" ONLY. So not ALL the code
needs to be downgraded, only those annotated with JSR330 annotations.
And yes, Maven 3.9.6 could upgrade Sisu to the latest version, basically
lifting this limitation.
HTH
T
On Mon, Oct 16, 2023 at 9:19 PM Garret Wilson <ga...@globalmentor.com>
wrote:
> Wait, really? I have an annotation processor being developed now with
> Java 17, and parts of it soon will need to move to a Maven plugin. This
> means that I'll have to downgrade all the code to Java 14?? In 2023?
>
> Are there any workarounds? The issue #94 you mentioned has already been
> closed as addressed. Are you saying that Sisu 0.9.0.M2 fixes the
> problem? Can't Maven 3.x simply upgrade to that and release v3.9.6?
>
> Garret
>
> On 10/16/2023 3:45 PM, Tamás Cservenák wrote:
> > Howdy,
> >
> > This mail is just a general response (initiated by those asking me in
> > private): it seems that the Maven team "forgot" to emphasize an important
> > question on the Maven site, while it is becoming more and more pressing,
> > especially as Java 17 is out long time ago, and Java 21 is here as well.
> >
> > In short: if you develop Java Mojo (a Maven plugin), that you plan to use
> > with current "stable" Maven versions (3.9.x and maybe 3.8,x), your
> > maven-plugin packaged artifact MUST NOT use Java bytecode that is newer
> > than Java 14!
> >
> > What happens is that Eclipse Sisu is unable to inspect the component
> > class/bytecode 14+ in question (despite is listed on index, in
> > META-INF/sisu/javax.inject.Named file), and it will silently ignore the
> > component, "pretend" like it's absent (and error reported will be like
> > Guice does not find the component to be injected). This can be seen, if
> you
> > make Sisu DEBUG (-Dsisu.debug on maven cli).
> >
> > Cause of limitation is the version of Eclipse Sisu used in Maven (the
> > JSR330 container implementation Maven uses internally), see
> > https://github.com/eclipse/sisu.inject/issues/94. Eclipse Sisu versions
> > 0.3.5 (used in Maven 3.8.x and 3.9.x) uses ASM that is able to scan
> > bytecode only up to Java 14. Latest release 0.9.0.M2 (used in Maven4) is
> > covering this up to Java21, while this issue above should fully cover,
> and
> > will probably be updated in Maven4 once released.
> >
> > So, for plugin devs targeting Maven3, best is to not exceed Java 14
> (safest
> > Java11) bytecode version for components (Mojos and JSR330 components).
> >
> > HTH
> > Tamas
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Authoring Maven Mojos for Maven 3.9.x - Maximum bytecode version=Java14
Posted by Garret Wilson <ga...@globalmentor.com>.
Wait, really? I have an annotation processor being developed now with
Java 17, and parts of it soon will need to move to a Maven plugin. This
means that I'll have to downgrade all the code to Java 14?? In 2023?
Are there any workarounds? The issue #94 you mentioned has already been
closed as addressed. Are you saying that Sisu 0.9.0.M2 fixes the
problem? Can't Maven 3.x simply upgrade to that and release v3.9.6?
Garret
On 10/16/2023 3:45 PM, Tamás Cservenák wrote:
> Howdy,
>
> This mail is just a general response (initiated by those asking me in
> private): it seems that the Maven team "forgot" to emphasize an important
> question on the Maven site, while it is becoming more and more pressing,
> especially as Java 17 is out long time ago, and Java 21 is here as well.
>
> In short: if you develop Java Mojo (a Maven plugin), that you plan to use
> with current "stable" Maven versions (3.9.x and maybe 3.8,x), your
> maven-plugin packaged artifact MUST NOT use Java bytecode that is newer
> than Java 14!
>
> What happens is that Eclipse Sisu is unable to inspect the component
> class/bytecode 14+ in question (despite is listed on index, in
> META-INF/sisu/javax.inject.Named file), and it will silently ignore the
> component, "pretend" like it's absent (and error reported will be like
> Guice does not find the component to be injected). This can be seen, if you
> make Sisu DEBUG (-Dsisu.debug on maven cli).
>
> Cause of limitation is the version of Eclipse Sisu used in Maven (the
> JSR330 container implementation Maven uses internally), see
> https://github.com/eclipse/sisu.inject/issues/94. Eclipse Sisu versions
> 0.3.5 (used in Maven 3.8.x and 3.9.x) uses ASM that is able to scan
> bytecode only up to Java 14. Latest release 0.9.0.M2 (used in Maven4) is
> covering this up to Java21, while this issue above should fully cover, and
> will probably be updated in Maven4 once released.
>
> So, for plugin devs targeting Maven3, best is to not exceed Java 14 (safest
> Java11) bytecode version for components (Mojos and JSR330 components).
>
> HTH
> Tamas
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org