Skip to content

JDK not auto-selected and outdated Gradle version #4956

@Kotlin-GDE

Description

@Kotlin-GDE

Summary

The IntelliJ IDEA Ktor plugin has two critical issues when creating new Ktor projects:

Does not automatically select the default JDK installed on the system
Uses outdated Gradle version (8.4 instead of current 8.10+)

Environment

IntelliJ IDEA Version: 2025.1.2
Ktor Plugin Version: 3.2.0
Operating System: Ubuntu 24.0.4
Default JDK Version: 24.04.10
Expected Gradle Version: 8.10
Actual Gradle Version Used: 8.4

Description

When creating a new Ktor project through the plugin, it does not automatically detect or select the default JDK that is properly configured in the system or IntelliJ IDEA.
Steps to Reproduce

Expected Behavior

The plugin should automatically detect and select the default JDK configured in:

IntelliJ IDEA's Project Structure settings
System JAVA_HOME environment variable
The most recent JDK version available in IntelliJ's SDK list

Actual Behavior

JDK field is empty or shows an incorrect/unavailable JDK
User must manually browse and select the JDK each time
May default to a non-existent or inappropriate JDK version

Issue 2: Outdated Gradle Version
Description
The Ktor plugin generates projects with Gradle version 8.4, which is outdated compared to the current stable release (8.10+).
Steps to Reproduce

Create a new Ktor project using the plugin
Check the generated gradle/wrapper/gradle-wrapper.properties file
Observe the distributionUrl property

Expected Behavior

Should use the latest stable Gradle version (8.10 or newer)
Should be updated regularly to match current Gradle releases

Actual Behavior

propertiesdistributionUrl=https://services.gradle.org/distributions/gradle-8.4-bin.zip
Impact

Missing out on performance improvements and bug fixes in newer Gradle versions
Potential compatibility issues with newer JDK versions
Inconsistent with recommended Gradle versions in official documentation

Suggested Solutions

For JDK Selection

Implement automatic detection of configured JDKs in this priority order:

Project-level default JDK (if creating in existing project)
IntelliJ IDEA's default JDK setting
JAVA_HOME environment variable
Latest compatible JDK version available

Add validation to ensure selected JDK is valid and accessible

For Gradle Version

Update the plugin to use Gradle 8.10 or later
Implement a mechanism to regularly update Gradle version in plugin releases
Consider making Gradle version configurable in the project creation wizard

Additional Information

This affects developer experience and project setup time
Forces manual intervention for what should be an automated process
May cause confusion for new Ktor developers

Workaround

Currently, users must:

Manually select the correct JDK during project creation
Manually update gradle-wrapper.properties after project creation to use newer Gradle version

Metadata

Metadata

Assignees

No one assigned

    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