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

No color/ansi support on Windows with 1.0.0? #1032

Closed
TobiX opened this issue Jun 18, 2024 · 6 comments · Fixed by #1040
Closed

No color/ansi support on Windows with 1.0.0? #1032

TobiX opened this issue Jun 18, 2024 · 6 comments · Fixed by #1040
Milestone

Comments

@TobiX
Copy link

TobiX commented Jun 18, 2024

When using mvnd 1.0 on Windows, I get this error:

Jun 18, 2024 10:55:45 AM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[main] WARNING org.jline - Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)

Digging deeper² the problem seems to be that no native access provider is packaged with jansi/jline:

Debugging output
FEIN: Unable to load ffm provider:
java.lang.UnsupportedClassVersionError: org/jline/terminal/impl/ffm/FfmTerminalProvider has been compiled by a more recent version of the Java Runtime (class file version 66.0), this version of the Java Runtime only recognizes class file versions up to 55.0
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1022)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.findClassInternal(ClassRealm.java:256)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:351)
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:36)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:225)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:210)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:205)
        at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:68)
        at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:704)
        at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:669)
        at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:416)
        at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:383)
        at org.mvndaemon.mvnd.common.logging.TerminalOutput.<init>(TerminalOutput.java:161)
        at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:146)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)

Juni 18, 2024 11:11:19 VORM. org.jline.utils.Log logr
FEIN: Exception while checking system stream (this may disable the JNI provider)
java.lang.NoClassDefFoundError: org/jline/nativ/Kernel32
        at org.jline.terminal.impl.jni.win.NativeWinSysTerminal.<clinit>(NativeWinSysTerminal.java:45)
        at org.jline.terminal.impl.jni.JniTerminalProvider.isWindowsSystemStream(JniTerminalProvider.java:147)
        at org.jline.terminal.impl.jni.JniTerminalProvider.isSystemStream(JniTerminalProvider.java:136)
        at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:705)
        at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:671)
        at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:416)
        at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:383)
        at org.mvndaemon.mvnd.common.logging.TerminalOutput.<init>(TerminalOutput.java:161)
        at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:146)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.lang.ClassNotFoundException: org.jline.nativ.Kernel32
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:225)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:210)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:205)
        ... 17 more

Juni 18, 2024 11:11:19 VORM. org.jline.utils.Log logr
FEIN: Unable to load jansi provider:
java.io.IOException: Unable to find terminal provider jansi
        at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
        at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:704)
        at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:673)
        at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:416)
        at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:383)
        at org.mvndaemon.mvnd.common.logging.TerminalOutput.<init>(TerminalOutput.java:161)
        at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:146)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)

Juni 18, 2024 11:11:19 VORM. org.jline.utils.Log logr
FEIN: Unable to load jna provider:
java.io.IOException: Unable to find terminal provider jna
        at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
        at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:704)
        at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:675)
        at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:416)
        at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:383)
        at org.mvndaemon.mvnd.common.logging.TerminalOutput.<init>(TerminalOutput.java:161)
        at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:146)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)

Juni 18, 2024 11:11:19 VORM. org.jline.utils.Log logr
FEIN: ExecTerminalProvider failed 'test -t' for Output
java.io.IOException: Cannot run program "test": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
        at org.jline.terminal.impl.exec.ExecTerminalProvider.isPosixSystemStream(ExecTerminalProvider.java:135)
        at org.jline.terminal.impl.exec.ExecTerminalProvider.isSystemStream(ExecTerminalProvider.java:121)
        at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:705)
        at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:677)
        at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:416)
        at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:383)
        at org.mvndaemon.mvnd.common.logging.TerminalOutput.<init>(TerminalOutput.java:161)
        at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:146)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden
        at java.base/java.lang.ProcessImpl.create(Native Method)
        at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:492)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:153)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
        ... 17 more

And indeed, putting (for example) jline-terminal-jni-3.26.1.jar into maven-mvnd-1.0.0-windows-amd64/mvn/lib/mvnd fixes the error.

Details for reproduction

² To get to this debug output I had to use the JVM wrapper (set MVND_CLIENT=jvm) and create a logging configuration like this:

handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = ALL
org.jline.level = ALL

and instruct the wrapper to use it:

set MAVEN_OPTS=-Djava.util.logging.config.file=C:\\DEV\\logging.properties
@cstamas
Copy link
Member

cstamas commented Jun 18, 2024

putting (for example) jline-terminal-jni-3.26.1.jar into maven-mvnd-1.0.0-windows-amd64/mvn/lib/mvnd fixes the error.

I downloaded Windows mvnd 1.0.0 distro, opened it up, and the file is there... so unsure what happens.

@TobiX
Copy link
Author

TobiX commented Jun 19, 2024

Ah sorry, that was a copy & paste error, I added jline-native-3.26.1.jar to make the message in the jvm variant of the launcher disappear.

The fix for the native client probably needs to be something different?!?

@cstamas
Copy link
Member

cstamas commented Jun 19, 2024

Yes, #1033 is exactly about that (adding missing native) plus adding "diag" cmd

@cstamas cstamas linked a pull request Jun 20, 2024 that will close this issue
cstamas added a commit that referenced this issue Jun 20, 2024
Fixing terminal on Windows.

changes:
* added missing jline-native to dist
* up GraalVM to 22
* introduce `--diag` on client
* up SVM version, cleanup of GraalVM params

Fixes #1032
@cstamas
Copy link
Member

cstamas commented Jun 20, 2024

Fixed with #1040

@cstamas cstamas closed this as completed Jun 20, 2024
@cstamas
Copy link
Member

cstamas commented Jun 20, 2024

Please retest with binaries built by CI from here:
https://github.com/apache/maven-mvnd/actions/runs/9597334445

@TobiX
Copy link
Author

TobiX commented Jun 20, 2024

@cstamas Works! Thanks!

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

Successfully merging a pull request may close this issue.

2 participants