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

オープン
#25,572 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Grinv がすでに取り組んでいます。

2026年11月6日 から。

  • #25573 @Grinv による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
kotlin
領域
build-system

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
26.9k
フォーク
7.8k
平均マージ
2日 10時間
マージ済み PR(30日)
180

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenAPITools/openapi-generator のほかの issue

OpenAPITools/openapi-generator の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。