Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘project’.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:148)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:39)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:59)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:504)
at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:83)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:129)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.api.GradleException: Unable to expand TAR ‘/path/to/jdk/archive/jdk-8u40-linux-x64.tar.gz’
The tar might be corrupted or it is compressed in an unexpected way.
By default the tar tree tries to guess the compression based on the file extension.
If you need to specify the compression explicitly please refer to the DSL reference.
at org.gradle.api.internal.file.archive.TarFileTree.visit(TarFileTree.java:79)
at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:96)
at org.gradle.api.internal.file.AbstractFileTree.getFiles(AbstractFileTree.java:37)
at build_465ftqg9bnx9fjui5v1nrftif.run(/path/to/project/build.gradle:40)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
… 32 more
Caused by: org.gradle.api.GradleException: Could not copy tar entry /path/to/jdk/archive/jdk-8u40-linux-x64.tar.gz!jdk1.8.0_40/README.html to ‘/path/to/project/build/tmp/expandedArchives/jdk-8u40-linux-x64.tar.gz_7rgta7iqynbzorxi3d85umfvr/jdk1.8.0_40/README.html’.
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:79)
at org.gradle.api.internal.file.archive.TarFileTree$DetailsImpl.getFile(TarFileTree.java:121)
at org.gradle.api.internal.file.AbstractFileTree$1.visitFile(AbstractFileTree.java:39)
at org.gradle.api.internal.file.archive.TarFileTree.visitImpl(TarFileTree.java:91)
at org.gradle.api.internal.file.archive.TarFileTree.visit(TarFileTree.java:70)
… 36 more
Caused by: java.io.FileNotFoundException: /path/to/project/build/tmp/expandedArchives/jdk-8u40-linux-x64.tar.gz_7rgta7iqynbzorxi3d85umfvr/jdk1.8.0_40/README.html (Permission denied)
at org.gradle.api.internal.file.AbstractFileTreeElement.copyFile(AbstractFileTreeElement.java:91)
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:74)
… 40 more
$ ls -l build/tmp/expandedArchives/jdk-8u40-linux-x64.tar.gz_7rgta7iqynbzorxi3d85umfvr/jdk1.8.0_40/README.html
-r–r--r-- 1 myuser myuser 159 Mar 20 16:05 build/tmp/expandedArchives/jdk-8u40-linux-x64.tar.gz_7rgta7iqynbzorxi3d85umfvr/jdk1.8.0_40/README.html
I notice that the file has a mode of 444. Could it just be that under the covers Gradle/Groovy/Java is trying to write to an existing read-only file without deleting it first? Not sure why it would be trying to untar it twice. For additional context, here is the relevant block of the build script up until the failing line:
configurations {
jdk
jce
}
dependencies.jdk “com.oracle.java.jdk:jdk:${version}:linux-x64@tar.gz”
dependencies.jce “com.oracle.java.jce:unlimited-jce-policy:${version[0]}@zip”
try { configurations.jdk.resolve() }
catch (org.gradle.api.artifacts.ResolveException e) {
println “We cannot build ${project.name} with version ‘${version}’. Try something like ‘8u40’”
System.exit(1)
}
println tarTree(configurations.jdk.singleFile).files