Skip to content

Gradle throws an exception when invoking the task ':printVersion' #986

@d-m-h

Description

@d-m-h
  • Apple M1 (MacOS Sequoia 15.5)
  • Gradle 8.12.1
  • Experimenting with includeBuild

I'm running this on a toy project that has the following structure:

.
├── apps
│   ├── client
│   │   ├── build.gradle.kts
│   │   └── settings.gradle.kts
│   └── server
│       ├── build.gradle.kts
│       └── settings.gradle.kts
├── libs
│   └── protocol
│       ├── build.gradle.kts
│       └── settings.gradle.kts
├── build.gradle.kts
└── settings.gradle.kts

Both client and server have includeBuild("../../libs/protocol") in their settings.gradle.kts files.

When running ./gradlew :protocol:printVersion, I get this error:

./gradlew :protocol:printVersion
Calculating task graph as no cached configuration is available for tasks: :protocol:printVersion

> Task :protocol:printVersion
6df7f87.dirty

[Incubating] Problems report is available at: file:///Users/dmh/Projects/gradle-monorepo/build/reports/problems/problems-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache problems found in this build.

5 problems were found storing the configuration cache, 4 of which seem unique.
- Build file 'libs/protocol/build.gradle.kts': external process started 'git describe --tags --always --first-parent --abbrev=7 --match=* HEAD'
  See https://docs.gradle.org/8.12.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Build file 'libs/protocol/build.gradle.kts': external process started 'git status --porcelain'
  See https://docs.gradle.org/8.12.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Build file 'libs/protocol/build.gradle.kts': external process started 'git version'
  See https://docs.gradle.org/8.12.1/userguide/configuration_cache.html#config_cache:requirements:external_processes
- Task `:protocol:printVersion` of type `org.gradle.api.DefaultTask`: 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.12.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types

See the complete report at file:///Users/dmh/Projects/gradle-monorepo/build/reports/configuration-cache/2nw0lxwdgf28j9zwxshg8ri46/1vm7wrdv5c1ytau1u2sbbnt3i/configuration-cache-report.html
> Starting an external process 'git version' during configuration time is unsupported.
> Starting an external process 'git describe --tags --always --first-parent --abbrev=7 --match=* HEAD' during configuration time is unsupported.
> Starting an external process 'git status --porcelain' during configuration time is unsupported.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
1 actionable task: 1 executed
Configuration cache entry discarded with 5 problems.

I can get around this by disabling the configuration cache, but that seems like I am just kicking the can down the road.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions