Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

Gradle build null console object

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 ")

When I run I get the error

Cannot invoke method readLine() on null object

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).

This issue is being tracked in Gradle's Github repo: Can't use System.console() with the Gradle Daemon.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For some reason, running gradle in daemon mode causes a null console object. If you specify the appropriate command line flag,

./gradlew assembleRelease --no-daemon

it'll work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...