'gradle run' does not work for spring-shell applications

Steps to reproduce

  • Download the spring-shell distribution

  • unpack the file and change into samples/helloworld

  • execute ‘gradle run’

Actual Result The application starts up but exits immediately without any error message.

Expected Result

  • execute ‘gradle insA’

  • execute ‘build/install/helloworld/bin/helloworld’

  • => the application stays in the prompt loop.

Lucky Guess I suspect that Gradle keeps hold on some console I/O resource.

It would ideally cease to hold that resource before executing the run task and reestablish it after the application quits.

I tried to narrow down the issue further but had no luck so far.

Any ideas/workarounds?

Related dependencies ##### spring-shell

  • net.sourceforge.jline:jline:1.0.S2-B

  • org.fusesource.jansi:jansi:1.8

Gradle
  • org.fusesource.jansi:jansi:1.2.1
Latest
  • jline:jline:2.9

  • org.fusesource.jansi:jansi:1.9

Gradle doesn’t “forward” its stdin on to processes that it executes during the build.

You can make it do this via:

run {
    standardInput = System.in
}

However, this currently is a little suboptimal due to our console prompt getting in the way. This is something that we will fix as it also effects things like the Scala REPL.

You are right: the workaround sure is suboptimal and more or less unusable if Gradle is started with default output.

But if I start the app with ‘gradle -q run’ everything works fine for me.

So thanks a lot! Perfect temporary workaround!

I am using the above as a workaround as well. However tab doesn’t seem to be captured within the shell it just moves the cursor - any suggestions?

Sorry, I realise I was kind of hijacking this question and have also discovered some further info, so I have created a new topic:

http://forums.gradle.org/gradle/topics/spring-shell-via-gradle-run-using-gradle-daemon