Uncategorized

Gradleを9.0.0にアップデートしたらFailed to load JUnit Platformと出たのを直したメモ

Gradle 9.0.0がリリースされました。手始めにシンプルなプロジェクトであるBusinessCalendar4Jのバージョンを上げてみました。

Gradleのアップデート

IntelliJ IDEAであればCtrlを2回押して”gradlew wrapper –gradle-version=9.0.0″を入力すればOK。

テストを実行

無事ビルド、テスト実行できるか試してみたところ”Could not start Gradle Test Executor 2: Failed to load JUnit Platform. Please ensure that the JUnit Platform is available on the test runtime classpath.”と出て失敗しました。

問題の解決方法についてはURLが提示されていますが、エラーメッセージでもGradle 9: Failed to load JUnit Platform. Please ensure that the JUnit Platform is available on the test runtime classpath. #34512がヒットしました。どちらも同じことが書いてあって、

testRuntimeOnly("org.junit.platform:junit-platform-launcher")

を追加すれば良いそうです。

というわけで、Gradle 9.0.0の新機能は何も活かしていないけれども無事テスト実行できるようになりました。

9.0.0にアップデートしたコミットはこちら