Moved from Gradle 1.12 to 2.0 and cannot capture console input in windows cmd or mingw


(Lee Davis) #1

Gradle 2.0 doesn’t appear to allow console input while running. For example answering y/n for some of the build tooling we are using. All the input in version 2.0 gets queued and upon terminating the task all the input is then fed into the console.

OS: Windows 7x64 Gradle: 2.0 Java: build 1.7.0_60-b19


#2

This could possibly due to the Groovy upgrade in Gradle 2.0. Can you please post some code that demonstrates the problem?


(Lee Davis) #3

Using the grails-gradle-plugin: https://github.com/grails/grails-gradle-plugin

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.grails:grails-gradle-plugin:2.1.0'
    }
}
  apply plugin: 'grails'
  version = '0.0.1'
group = "foobar"
  grails {
    grailsVersion = '2.4.2'
     groovyVersion = '2.3.3'
     springLoadedVersion = '1.2.0.RELEASE'
 }
  repositories {
    mavenCentral()
    jcenter()
    grails.central()
 }
  dependencies {
    bootstrap group: 'org.grails.plugins', name: 'tomcat', version: '7.0.54'
     bootstrap group: 'com.h2database', name: 'h2', version: '1.4.178'
       compile group: 'org.grails.plugins', name: 'asset-pipeline', version: '1.8.11'
     compile group: 'org.grails.plugins', name: 'cache', version: '1.1.7'
     compile group: 'org.grails.plugins', name: 'scaffolding', version: '2.1.2'
    compile group: 'org.grails.plugins', name: 'joda-time', version: '1.5'
     compile group: 'org.jadira.usertype', name: 'usertype.jodatime', version: '2.0.1'
      runtime ('org.grails.plugins:hibernate4:4.3.5.4') {
         exclude module: 'xml-apis'
    }
    runtime group: 'org.grails.plugins', name: 'cors', version: '1.1.6'
}

Run command:

./gradlew grails-generate-controller -PgrailsArgs=com.MyDomainClass

This is a fair amount of effort, but I’ll see If I can produce a more simplistic example.


(Lee Davis) #4

With the above build file you should actually be able to run:

./gradlew init

That will initialize a grails project and should prompt you for input


#5

Not being familiar with the Grails plugin, it’s hard for me to say. Can you please follow up with the plugin author at https://github.com/grails/grails-gradle-plugin? (https://github.com/johnrengelman)


(Lee Davis) #6

Certainly, I’ll follow up with with the plugin owner. I also don’t claim to be a gradle expert is there an easy way to initiate user input with a simple gradle build task as a test, as I would like to test that.


(Lee Davis) #7

Posted with the plugin owner. https://github.com/grails/grails-gradle-plugin/issues/111