Skip to content

Conversation

@entrypointkr
Copy link
Contributor

@entrypointkr entrypointkr commented Dec 17, 2025

YouTrack: https://youtrack.jetbrains.com/issue/IDEA-383419/IDEA-EXT-Alternative-JRE-Path-in-JarApplication

Releated PR: JetBrains/gradle-idea-ext-plugin#140

Purpose

To support configuring the JRE option for IntelliJ IDEA Run Configurations — JarApplication / Application — via gradle-idea-ext.

Implementation

I opened the PR to make gradle-idea-ext export alternativeJrePath, and implemented the code and tests to read it from each IntelliJ IDEA importer and apply it.

Main changes

I removed deprecated consumeIfCast usage in each importer and updated it to use pattern variables.

Fields related to the JRE path are in:

JvmConfigurationOptions( // com.intellij.execution.JvmConfigurationOptions
  alternativeJrePath: String?,
  isAlternativeJrePathEnabled: Boolean,
)

If the input alternativeJrePath is present and not empty, set (alternativeJrePath, true).
otherwise, set (null, false).
What I want to emphasize here is that it is also set to (null, false) when the value is empty. Would it be a problem that there is no case where it becomes ("", true)?

Also, in each test, I used JavaApplicationRunConfigurationImporter / JarApplicationRunConfigurationImporter instead of TestRunConfigurationImporter to verify that the configuration was applied correctly.

Extra changes

  • ApplicationConfiguration:
    • Updated the part that uses the deprecated field MAIN_CLASS_NAME: ApplicationModulePathTest#L111
    • Updated the comment on the deprecated field.
  • Fixed an issue that occurs when testing idea-ext from a local repository that has not been published yet: TestGradleBuildScriptBuilder#L92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants