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

Grails 7: Console and Cli rewrite for org.jline:jline:3.0.0-3.27.1 #13752

Open
jamesfredley opened this issue Oct 14, 2024 · 3 comments
Open

Comments

@jamesfredley
Copy link
Contributor

jamesfredley commented Oct 14, 2024

#13474 trigged this issue and it was resolved for now, by #13801 (review)

https://mvnrepository.com/artifact/jline/jline/2.14.6 is not compatible with https://mvnrepository.com/artifact/org.fusesource.jansi/jansi/2.4.1

Moving to https://mvnrepository.com/artifact/org.jline/jline/3.0.0 - https://mvnrepository.com/artifact/org.jline/jline/3.27.1 will require a rewrite of:

grails.build.logging.GrailsConsole
grails.build.logging.GrailsEclipseConsole
org.grails.build.interactive.CandidateListCompletionHandler
org.grails.cli.GrailsCli
org.grails.cli.*.*

Issue description

org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not complete execution for Gradle Test Executor 13.
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:65)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:92)
	at jdk.proxy1/jdk.proxy1.$Proxy4.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:200)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:132)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:103)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:63)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:121)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: org.junit.platform.commons.JUnitException: TestEngine with ID 'spock' failed to discover tests
	at app//org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:160)
	at app//org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:132)
	at app//org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:107)
	at app//org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:78)
	at app//org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:99)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85)
	at app//org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:124)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:99)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:94)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:63)
	... 18 more
Caused by: java.lang.NoSuchMethodError: 'java.io.OutputStream org.fusesource.jansi.AnsiConsole.wrapOutputStream(java.io.OutputStream)'
	at jline.AnsiWindowsTerminal.detectAnsiSupport(AnsiWindowsTerminal.java:57)
	at jline.AnsiWindowsTerminal.<init>(AnsiWindowsTerminal.java:27)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
	at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
	at java.base/java.lang.Class.newInstance(Class.java:645)
	at jline.TerminalFactory.getFlavor(TerminalFactory.java:205)
	at jline.TerminalFactory.create(TerminalFactory.java:96)
	at jline.TerminalFactory.get(TerminalFactory.java:180)
	at jline.TerminalFactory.get(TerminalFactory.java:186)
	at jline.console.ConsoleReader.<init>(ConsoleReader.java:244)
	at jline.console.ConsoleReader.<init>(ConsoleReader.java:236)
	at jline.console.ConsoleReader.<init>(ConsoleReader.java:228)
	at grails.build.logging.GrailsConsole.createConsoleReader(GrailsConsole.java:247)
	at grails.build.logging.GrailsConsole.initialize(GrailsConsole.java:183)
	at grails.build.logging.GrailsConsole.<init>(GrailsConsole.java:156)
	at grails.build.logging.GrailsConsole.createInstance(GrailsConsole.java:387)
	at grails.build.logging.GrailsConsole.getInstance(GrailsConsole.java:307)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
	at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1989)
	at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3900)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at grails.build.logging.GrailsConsoleSpec$_closure1.doCall(GrailsConsoleSpec.groovy:41)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
	at groovy.lang.Closure.call(Closure.java:433)
	at groovy.lang.Closure.call(Closure.java:422)
	at org.spockframework.runtime.extension.builtin.ConditionalExtension.evaluateCondition(ConditionalExtension.java:124)
	at org.spockframework.runtime.extension.builtin.ConditionalExtension.evaluateCondition(ConditionalExtension.java:112)
	at org.spockframework.runtime.extension.builtin.ConditionalExtension.visitSpecAnnotation(ConditionalExtension.java:58)
	at org.spockframework.runtime.extension.IAnnotationDrivenExtension.visitSpecAnnotations(IAnnotationDrivenExtension.java:40)
	at org.spockframework.runtime.ExtensionRunner.doRunAnnotationDrivenExtensions(ExtensionRunner.java:124)
	at org.spockframework.runtime.ExtensionRunner.doRunAnnotationDrivenExtensions(ExtensionRunner.java:114)
	at org.spockframework.runtime.ExtensionRunner.runAnnotationDrivenExtensions(ExtensionRunner.java:65)
	at org.spockframework.runtime.ExtensionRunner.runAnnotationDrivenExtensions(ExtensionRunner.java:54)
	at org.spockframework.runtime.ExtensionRunner.run(ExtensionRunner.java:44)
	at org.spockframework.runtime.SpockEngineDiscoveryPostProcessor.processSpecNode(SpockEngineDiscoveryPostProcessor.java:52)
	at org.spockframework.runtime.SpockEngineDiscoveryPostProcessor.lambda$postProcessEngineDescriptor$0(SpockEngineDiscoveryPostProcessor.java:16)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at org.spockframework.runtime.SpockEngineDiscoveryPostProcessor.postProcessEngineDescriptor(SpockEngineDiscoveryPostProcessor.java:17)
	at org.spockframework.runtime.SpockEngine.discover(SpockEngine.java:31)
	at org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:152)
	... 28 more
@jamesfredley jamesfredley moved this to Todo in Grails 7 Oct 14, 2024
@jamesfredley jamesfredley changed the title Grails 7: java.lang.NoSuchMethodError: 'java.io.OutputStream org.fusesource.jansi.AnsiConsole.wrapOutputStream(java.io.OutputStream)' Grails 7: Console and Cli rewrite for org.jline:jline:3.0.0-3.27-1 Oct 22, 2024
@jamesfredley jamesfredley changed the title Grails 7: Console and Cli rewrite for org.jline:jline:3.0.0-3.27-1 Grails 7: Console and Cli rewrite for org.jline:jline:3.0.0-3.27.1 Oct 22, 2024
@matrei
Copy link
Contributor

matrei commented Oct 23, 2024

@jamesfredley Where are you getting this error?

@jamesfredley
Copy link
Contributor Author

@matrei I was before #13801 (review). I also ran into it back when consolidating the versions into gradle.properties and went with jansi 1.18 then as well, due to this error.

jansi:2.0.0-2.4.1 all trigger it with jline:jline:2.14.6

I think #13805 (comment) would help avoid OS specific situations when apply updates from dependabot.

@codeconsole
Copy link
Contributor

codeconsole commented Nov 24, 2024

Jline 3.27.1 is the current version.

implementation "org.jline:jline:3.27.1"

https://github.com/jline/jline3

t's definitely not a drop-in replacement.
During development, I haven't considered compatibility as a goal at all, so I changed a lot of APIs. The package have been renamed, a lot of new interfaces have been introduced for various features (Parser, Highlighter...). The completers have changed also to support description, coloring, complete/incomplete, with one main difference is that the completers can return all possibilities, as the console reader will find matching candidates within that list.
Obtaining a terminal can be done using:

  Terminal terminal = TerminalBuilder.builder()
              // further customization
              .builder();
And the reader using:
   LineReader reader = LineReader.builder()
             .terminal(terminal)
              // further customization
             .build();

Reading lines is done in the same way using the various readLine() methods.
https://groups.google.com/g/jline-users/c/ebQxEFUVkKs

More upgrade discussion:
https://groups.google.com/g/jline-users/c/PEWgDPSOUt4/m/2qU63kgWDAAJ

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

No branches or pull requests

3 participants