Skip to content

XTC plugin warns 'unspecified version' for Gradle's synthetic gradle-kotlin-dsl-accessors project #767

Open

Description

@lagergren

Problem

XtcProjectDelegate.apply calls checkProjectIsVersioned(project) at plugin-apply time (XtcProjectDelegate.java#L320, #L876-L880). It runs on every project the plugin is applied to, including the synthetic project Gradle creates to generate type-safe accessors for precompiled script plugins. That project never has a version, so any build whose convention plugin applies the XTC plugin in its plugins {} block prints:

> Task :build-logic:generatePrecompiledScriptPluginAccessors
[plugin] WARNING: Project 'gradle-kotlin-dsl-accessors' has unspecified version.

xtclang/examples hits this. build-logic/src/main/kotlin/xtc-conventions.gradle.kts declares id("org.xtclang.xtc-plugin") in its plugins {} block. All of its real projects are versioned (version=0.1.0 in gradle.properties, and chess-game sets its own), and the warning prints exactly once per build, for Gradle's accessor project. It appears both locally and in CI ("Build & test" and "Docker image build" in the examples master run on Gradle 9.8.2), and it is unchanged on Gradle 9.9.1 (xtclang/examples#30).

Consumers cannot fix this: they cannot set a version on Gradle's synthetic project. The only consumer-side workaround is to apply the XTC plugin with apply(plugin = ...) instead of in plugins {}, which gives up type-safe accessors in the convention plugin.

Because the check runs at apply time, it also sees the version before the rest of the build script runs. A project that applies the plugin in plugins {} and sets version = ... later in the script body would get the same spurious warning, even though its version is set.

Suggested fix

Change the check in checkProjectIsVersioned so it warns only about real, unversioned projects, for example:

  • Skip Gradle's accessor-generation project (its name is gradle-kotlin-dsl-accessors). This is a small change but depends on a Gradle-internal name.
  • Or, preferably, move the check out of apply time, so that it reads the final version and never runs for the accessor project, which is only configured and never runs tasks. Doing it at execution time, in a task that actually depends on the version, keeps it configuration-cache friendly.

Acceptance

  • Building xtclang/examples with a plugin snapshot that includes the fix no longer prints the warning.
  • A real project with an unspecified version still gets the warning.

Activity

  1. self-assigned this
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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