我使用gradle与Stanford Phrasal合作。
当我使用命令gradle run
时,它失败并发出以下错误。
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/oracle_jdk8/bin/java'' finished with non-zero exit value 255
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
当我尝试gradle run --stacktrace
时,我得到了关注,
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':run'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
... 58 more
答案 0 :(得分:0)
application plugin添加了run
任务。它的类型为JavaExec,只运行build.gradle中mainClassName
定义的类;在你的情况下是edu.stanford.nlp.mt.Phrasal
现在正如@Bohemian所说,你的堆栈跟踪并没有告诉你太多,因为它只是说java进程返回-1
,这可能发生在Phrasal中的几个code lines that exit with -1之一。
向gradle命令添加--debug
或--info
没有帮助,因为它们只是更改了gradle进程的日志级别,而不是JavaExec(run)任务启动的单独java进程。
最简单的调试方法是运行distZip
任务,它创建一个可执行jar的zip文件和所有必需的依赖项,解压缩它,并从命令行运行带有java -jar
的jar 。这应该会提供有关失败发生位置的更多有用的错误消息,您可以从那里开始修复它。