摇篮建立空控制台对象 [英] Gradle build null console object

查看:146
本文介绍了摇篮建立空控制台对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我建立的gradle在控制台提示利用堆栈溢出的例子密码

I'm trying to get my gradle builds to prompt at the console for a password using examples from stack overflow

当我有一个说明书,如:

When I have a statment such as:

def password = System.console().readLine("Enter keystore password ")

当我跑我的错误

 > Cannot invoke method readLine() on null object

这似乎控制台被说成空。我读过这需要Java 6,如果我去,我正在运行的Java(TM)SE运行时环境的命令提示符,然后键入Java的版本(建1.6.0_27-B07)

It seems console is coming out as null. What I've read this requires java 6 which if I go to a command prompt and type java -version I'm running Java(TM) SE Runtime Environment (build 1.6.0_27-b07)

推荐答案

好吧,之所以这次没有工作是愚蠢的,但以防万一别人遇到它,我想我会发布。

Ok, the reason why this didn't work was silly, but just in case anyone else comes across it I thought I'd post.

我是通过机器人工作室正在运行的任务,并没有意识到,在控制台对象总是为空。当从命令行运行命令对象不为空,它工作正常。

I was running the task through android studio and didn't realise that the console object would always be null. When running from the command line the "command" object isn't null and it works ok.

这篇关于摇篮建立空控制台对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆