Skip to content

Generated JVM Groovy projects fail to build #359

Description

@cdsap

Summary

Generated JVM projects using Groovy DSL fail during root build script compilation because the generated build.gradle contains Kotlin DSL plugin syntax.

Reproducer

./gradlew :cli:fatBinary
./cli/projectGenerator generate-project \
  --modules 6 \
  --layers 5 \
  --type jvm \
  --language groovy \
  --shape rectangle \
  --output-dir /tmp/pg-jvm-groovy
cd /tmp/pg-jvm-groovy
./gradlew build

Expected behavior

The generated Groovy DSL project builds successfully.

Actual behavior

Gradle rejects the Kotlin DSL kotlin("jvm") call in the generated Groovy plugins block.

Evidence

  • JDK: OpenJDK 23.0.2 (Zulu)
  • OS: macOS 26.2
  • Generator command: ./cli/projectGenerator generate-project --modules 6 --layers 5 --type jvm --language groovy --shape rectangle --output-dir /tmp/pg-jvm-groovy
  • Generated project command: ./gradlew build
  • Error excerpt:
Build file '/tmp/pg-jvm-groovy/build.gradle' line: 2

only id(String), alias(Provider), or alias(ProviderConvertible) method calls allowed in plugins {} script block

@ line 2, column 5.
    kotlin("jvm") version("2.4.0") apply false
    ^

The root build script is generated by BuildGradle.getJvm, and the same content is currently written for both DSLs.

Scope

Affected area:

  • CLI
  • YAML parsing
  • Core generator
  • Android generation
  • JVM generation
  • Gradle version support
  • Documentation
  • Tests

Suggested fix or test

Render Groovy-compatible JVM root plugin syntax when the output extension is gradle. Add a focused E2E test that generates a minimal JVM Groovy project and runs ./gradlew build; also cover language=both so both generated variants are built.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions