[BUG][KOTLIN] build.gradle generated with idea=true fails on Gradle 9 (testSourceDirs)

Đang mở
#25,572 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Grinv đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #25573 của @Grinv — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
15/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
kotlin
Lĩnh vực
build-system

Hướng nghiên cứu

Read kotlin-client/build.gradle.mustache and inspect how its idea module configures test source directories. The report identifies replacing testSourceDirs with testSources.from(file('src/test/kotlin')) and gives Gradle 7.6.2 and 9.8.2 as compatibility points. A linked pull request, #25573, is already open.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

With idea=true, kotlin-client/build.gradle.mustache adds an idea { module { ... } } block that sets testSourceDirs. Gradle 8.14 warns that the property is deprecated ("scheduled to be removed in Gradle 9.0. Please use the testSources property instead"), and Gradle 9 removed it, so the generated project fails to configure. The same project builds on Gradle 8.14, and without idea=true it builds on 9.

openapi-generator version

7.27.0, and master at d15b0164 (7.28.0-SNAPSHOT).

OpenAPI declaration file content or url

modules/openapi-generator/src/test/resources/3_0/petstore.yaml from this repo (validate reports no issues).

Generation Details
java -jar openapi-generator-cli.jar generate -g kotlin \
  -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml \
  -o out --additional-properties=idea=true
Steps to reproduce

Run gradle compileKotlin in out with Gradle 9.8.2:

* Where:
Build file '.../build.gradle' line: 59

* What went wrong:
Could not get unknown property 'testSourceDirs' for object of type org.gradle.plugins.ide.idea.internal.IdeaModuleInternal.

Expected: it configures and compiles.

Related issues/PRs

#22084, fixed for the Java templates in #24649.

Suggest a fix

testSources.from(file('src/test/kotlin')) instead of testSourceDirs += file('src/test/kotlin'). testSources exists since Gradle 7.4 (tested on 7.4, 7.6.2, 8.14 and 9.8.2; it fails on 7.3), and the oldest wrapper the template ships is 7.6.2 (for jvm-volley). PR to follow.

Ngôn ngữ chính
Java
Star
26.9k
Fork
7.8k
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
180

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenAPITools/openapi-generator

Tất cả issue của OpenAPITools/openapi-generator

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.