Skip to content
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

Cannot user jline3 uber jar rewrapped in other jars because of jfr usage. #937

Closed
clebertsuconic opened this issue Jan 31, 2024 · 18 comments
Milestone

Comments

@clebertsuconic
Copy link

would be possible to set the target to JDK 11 when you build a release?

We use JDK 11 to build artemis, and we just tried to upgrade to jline latest and we had issues:

INFO] Finished at: 2024-01-31T13:18:10-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor (default-descriptor) on project artemis-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor failed: Unsupported class file major version 65 -> [Help 1]

@clebertsuconic
Copy link
Author

clebertsuconic commented Jan 31, 2024

we tried to upgrade it here:

apache/activemq-artemis#4790

we downgraded to 2.24, but it's missing native libraries apparently.

@clebertsuconic
Copy link
Author

hmmm.. I just tried with JDK 21:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor (default-descriptor) on project artemis-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor failed: Unsupported class file major version 65 ->

@clebertsuconic
Copy link
Author

It seems there's some graalvm specific incubating feature on 2.25.

@gnodet
Copy link
Member

gnodet commented Jan 31, 2024

If you depends on the JLine uber-jar (org.jline:jline), then it includes some classes which are in preview in JDK 21. You need to adjust your build to avoid the checks on those classes, or use smaller JLine jars (excluding the jline-terminal-ffm which is compiled with FFM support, in preview in JDK 21).

@clebertsuconic
Copy link
Author

@gnodet I can do that, but this "new incubating" dependency should be an extra jar IMO, not part of the default usage.

@clebertsuconic
Copy link
Author

@gnodet can you use this JIRA to place jline-terminal-ffm outside of the uber jar? and have anyone needing this feature just use that JAR?

@clebertsuconic clebertsuconic changed the title Cannot using jline3 in compilation with JDK 11 Uber jar is unusable because of terminal-frm Feb 1, 2024
@clebertsuconic
Copy link
Author

I renamed this as this issue will affect anyone using the uber jar. as it's affecting any jdk

@gnodet
Copy link
Member

gnodet commented Feb 1, 2024

@gnodet can you use this JIRA to place jline-terminal-ffm outside of the uber jar? and have anyone needing this feature just use that JAR?

I don't have a problem removing it from the JLine bundle if the source of the problem is that the code targets the JDK 21 preview (with class file version xxx.65535). However, it may come back whenever the preview mode for FFM is removed, which should be in JDK 22, coming out soon.
So if the problem is purely Unsupported class file major version 65, I'm not sure it will really work.
The maven-plugin-plugin can be forced with a minimum required JDK afaik, so it may be better in your case.

@gnodet
Copy link
Member

gnodet commented Feb 1, 2024

I renamed this as this issue will affect anyone using the uber jar. as it's affecting any jdk

What do you mean it's affecting any JDK ? The provider is optional, so I think it's perfectly usable. It's just that the mavne-plugin-plugin does check the class version to find out the minimum requirement.

@clebertsuconic
Copy link
Author

I'm not using the feature at all.. I just have a depency on org.jline from artemis.. and that was enough for me to hit the issue.

if I use the latest org.jline version I can't compile at all.

@clebertsuconic
Copy link
Author

git clone https://github.com/clebertsuconic/activemq-artemis.git
cd activemq-artemis
git checkout jline
mvnd install -DskipTests=true

you will see this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor (default-descriptor) on project artemis-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor failed: Unsupported class file major version 65 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

All I'm doing is using this through piccocli.jline integration.

@clebertsuconic
Copy link
Author

although.. the issue is on my maven plugin wrapping.. let me debug the build there and I will be back here with more info.

@clebertsuconic
Copy link
Author

I'm sorry about this.. I thought this was something else.. let me debug this a bit more.. will come back with more details.

@clebertsuconic
Copy link
Author

the issue is that I have a maven-plugin that uses my CLI, and the CLI has a dependency on the jline.. .maven plugin is doing a rewrapping of the jar, what's hitting that issue.

I didn't need jline on the maven plugin so I am making picocli and jline as provided.

but it would be nicer if this jfr wasn't part of the uber jar to avoid issues like this.

@clebertsuconic clebertsuconic changed the title Uber jar is unusable because of terminal-frm Cannot user jline3 uber jar rewrapped in other jars because of jfr usage. Feb 1, 2024
@clebertsuconic
Copy link
Author

I renamed the issue here trying to be more precise on what's the actual issue.

@clebertsuconic
Copy link
Author

@gnodet I can't build this even with JDK 21. it only works on the preview.

I had to change my code to have my maven plugin ignoring jline.

I have a workaround for my project but IMHO you should move this outside of the default jar..

@gnodet
Copy link
Member

gnodet commented Mar 6, 2024

I think I’ll provide a new package with -jdk8 as a classifier so that people can use an Uber jar with no jdk21/preview code in it (and next version will have FFM support requiring JDK22, but not in preview as FFM has been finalized).

@gnodet gnodet added this to the 3.26.0 milestone Mar 6, 2024
@clebertsuconic
Copy link
Author

I think it would be easier to move the JFR usage away from the uber jar. but I'm fine with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants