gradle 进程命令 java 以非零退出值 1 结束

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34425992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 15:38:20  来源:igfitidea点击:

gradle process command java finished with non-zero exit value 1

javaspringgradlespring-bootbuild.gradle

提问by CodeMed

I am getting the following error when I type gradle bootRun --stacktrace --debugin the CentOS 7 terminal to use gradle to launch this sample spring boot app.

当我gradle bootRun --stacktrace --debug在 CentOS 7 终端中输入以使用 gradle 启动此示例 spring boot app时,出现以下错误。

Caused by: org.gradle.process.internal.ExecException:  
Process 'command '/opt/jdk1.8.0_45/bin/java'' finished with  
non-zero exit value 1

I have googled this error and read other SO postings that are similar but not duplicates. For example, this is in eclipse in CentOS 7 and a web app. This is not an android app, etc. Also, commands given in other postings have not resolved this problem.

我用谷歌搜索了这个错误并阅读了其他类似但不重复的 SO 帖子。例如,这是在 CentOS 7 中的 eclipse 和 Web 应用程序中。这不是 android 应用程序等。另外,其他帖子中给出的命令也没有解决这个问题。

All of the code required to reproduce this problem is in the github link above, and all of the logs to diagnose the problem is in this OP below. How do I resolve this error so that I gradle bootRuncan succussfully launch the sample app?

重现此问题所需的所有代码都在上面的 github 链接中,诊断问题的所有日志都在下面的这个 OP 中。 如何解决此错误,以便我gradle bootRun可以成功启动示例应用程序?



STEP BY STEP REPRODUCTION OF THE PROBLEM:

问题的逐步重现:



I downloaded the app as-is by navigating to /home/user/workspaces/and typing git clone https://github.com/jrodenbostel/beyond-the-examples

我通过导航到/home/user/workspaces/并键入来按原样下载应用程序git clone https://github.com/jrodenbostel/beyond-the-examples

I then navigated to cd /home/user/workspaces/beyond-the-examples/part-5and typed gradle bootRun --stacktrace --debug, which resulted in the stack trace and logs that you can read by clicking on this link to a file sharing site.(The logs are too long to include in this OP.)

然后我导航到cd /home/user/workspaces/beyond-the-examples/part-5并输入gradle bootRun --stacktrace --debug,这会产生堆栈跟踪和日志,您可以通过单击此链接到文件共享站点来阅读这些日志。(日志太长,无法包含在此 OP 中。)

采纳答案by DavidR

Looking at the logs this appears to be your problem:

查看日志,这似乎是您的问题:

nested exception is org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [inser t into users (username, password, enabled) values (?,?,?)]; Data truncation: 
Data too long for column 'password' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1. 

Anyway you can truncate the password size? Otherwise increasing the 'password' column size should do the trick.

无论如何,您可以截断密码大小吗?否则增加“密码”列大小应该可以解决问题。

回答by Gene

This was my original error message:

这是我原来的错误信息:

enter image description here

在此处输入图片说明

Changing my %JAVA_HOME%in Window's Environmental Variables from Java 9 (file directory C:\Program Files\Java\jdk-9.0.1) to Java 8 (C:\Program Files\Java\jdk1.8.0_151) was what fixed it for me. You can figure out what path you set %JAVA_HOME% to by typing echo %JAVA_HOME%in Command Prompt.

将我%JAVA_HOME%在 Window 中的环境变量从 Java 9(文件目录C:\Program Files\Java\jdk-9.0.1)更改为 Java 8(C:\Program Files\Java\jdk1.8.0_151)对我来说是固定的。您可以通过echo %JAVA_HOME%在命令提示符中键入来确定您将 %JAVA_HOME% 设置为的路径。

So yea, as of 12-20-2017, gradle bootRundoesn't play well with Java 9. Hopefully that will be fixed soon and I can delete this answer.

所以是的,截至 2017 年 12 月 20 日gradle bootRun,Java 9 不能很好地发挥作用。希望这会很快得到修复,我可以删除这个答案。