所以我的gradle构建文件在Windows中工作正常,所有测试都在通过。现在我也试图让我的所有测试都通过linux。
以下是回购的链接:https://github.com/quinnliu/WalnutiQ
我先按照以下说明安装gradle:
unix> wget http://services.gradle.org/distributions/gradle-1.10-bin.zip
unix> sudo unzip -q gradle-1.10-bin.zip -d /usr/local/
unix> echo "export GRADLE_HOME=/usr/local/gradle-1.10" >> .profile
unix> echo "export PATH=$PATH:$GRADLE_HOME/bin" >> .profile
然后我在git克隆后导航到WalnutiQ文件夹。
输入命令行“gradle build --stacktrace”后,我收到以下错误:
[ubuntu@ip-172-31-25-10:~/Desktop/WalnutiQ]$gradle build --stacktrace :compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
Cause: Could not generate test report to '/home/ubuntu/Desktop/WalnutiQ/build/reports/tests'.
Cause: java.lang.NullPointerException (no error message)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':test'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:71)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:48)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:237)
at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:167)
at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:160)
at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:78)
at org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:113)
at org.gradle.execution.DelegatingBuildExecuter.execute(DelegatingBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:41)
at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:27)
at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:219)
at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:203)
at org.gradle.launcher.Main.execute(Main.java:55)
at org.gradle.launcher.Main.main(Main.java:40)
at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:46)
at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:28)
at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: org.gradle.api.GradleException: Could not generate test report to '/home/ubuntu/Desktop/WalnutiQ/build/reports/tests'.
at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.generateFiles(DefaultTestReport.java:125)
at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.generateReport(DefaultTestReport.java:51)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestFramework.report(JUnitTestFramework.java:71)
at org.gradle.api.tasks.testing.Test.executeTests(Test.java:334)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
at org.gradle.api.tasks.testing.Test_Decorated.invokeMethod(Unknown Source)
at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:129)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$2.execute(AnnotationProcessingTaskFactory.java:127)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:63)
... 28 more
Caused by: java.lang.NullPointerException
at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.copyResource(DefaultTestReport.java:168)
at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.copyResources(DefaultTestReport.java:157)
at org.gradle.api.internal.tasks.testing.junit.report.DefaultTestReport.generateFiles(DefaultTestReport.java:122)
... 38 more
BUILD FAILED
Total time: 1 mins 7.262 secs
答案 0 :(得分:0)
可能是权限错误吗?尝试以超级用户(sudo)身份运行或将gradle安装到完全控制范围内的某个位置。扫描源代码,它会建议将其从gradle安装文件失败复制到项目的构建目录。因此,文件丢失,或者我们收到了权限问题。
答案 1 :(得分:0)
我收到相同的错误,但文件都已成功写入。我运行构建后可以看到它们。