Gradle configuration cache support
artemptushkin opened this issue · 2 comments
Environment:
- Jib version: 3.4.0
- Build tool: Gradle 8.6
- OS: apple M1 macbook
Description of the issue:
The job
task fails running if configuration cache is enabled, regardless or the warnings, i.e. in warn
enabled we expect it to be logged but not error should be.
If with the same configuration you switch back the configuration cache to false
it works.
The core error:
Cannot invoke "org.gradle.api.Project.getProjectDir()" because "this.project" is null
Expected behavior:
The build passes if no unrelated issues
Steps to reproduce:
- Enable Gradle configuration cache with
warn
:
# gradle.properties
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
- Run
jib
task e.g../gradlew jib
jib-gradle-plugin
Configuration:
jib {
container {
mainClass = "x.y.z.FooKt"
}
from {
image = "eclipse-temurin:21-jre"
}
}
Log output:
> Task :distribution:jib FAILED
10 problems were found storing the configuration cache, 2 of which seem unique.
- Task `:distribution:jib` of type `com.google.cloud.tools.jib.gradle.BuildImageTask`: cannot deserialize object of type 'org.gradle.api.Project' as these are not supported with the configuration cache.
See https://docs.gradle.org/8.6/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:distribution:jib` of type `com.google.cloud.tools.jib.gradle.BuildImageTask`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
See https://docs.gradle.org/8.6/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
See the complete report at file:///builds/foo/build/reports/configuration-cache/kuk15qcl6k2hj0snqht5et0a/3kly9i8hjlwaqpdaqa3d2z42e/configuration-cache-report.html
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':distribution:jib'.
> Cannot invoke "org.gradle.api.Project.getProjectDir()" because "this.project" is null
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':distribution:jib'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)
at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: java.lang.NullPointerException: Cannot invoke "org.gradle.api.Project.getProjectDir()" because "this.project" is null
at com.google.cloud.tools.jib.gradle.ExtraDirectoriesParameters.getPaths(ExtraDirectoriesParameters.java:86)
at com.google.cloud.tools.jib.gradle.ExtraDirectoriesParameters_Decorated.getPaths(Unknown Source)
at com.google.cloud.tools.jib.gradle.ExtraDirectoriesParameters.getPathStrings(ExtraDirectoriesParameters.java:65)
at com.google.cloud.tools.jib.gradle.ExtraDirectoriesParameters_Decorated.getPathStrings(Unknown Source)
Additional information
Another day I created an issue in Gradle but they closed it with the documentation update because the failure is only in the plugin itself and unrelated to Gradle
Duplicate of #3132? (Which interestingly has a different priority than this issue.)
@sschuberth yes indeed, it's a duplicate
closing in favour of #3132