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-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to