Tooling problem - Starting run configuration does not trigger a rebuild



I am using IntelliJ 2018.1 and the lastest stable Kotlin version + plug-in in a Gradle project.
My problem is, that no build sis invoked when starting a run configuration:

What I tried:

  • File | Settings | Build, Execution, Deployment | Compiler | Kotlin Compiler --> Disabled “Keep compiler processes alive during invocations”
  • File | Settings | Build, Execution, Deployment | Compiler --> Everything (especially “build project automatically” is ticked)
  • File | Settings | Build, Execution, Deployment | Build Tools | Gradle --> Tried default wrapper and wrapper task
  • File | Settings | Build, Execution, Deployment | Build Tools | Gradle | Runner --> Set and unset the Delegate IDE build options

Someone has an idea how to let IntelliJ biuld the changed fils, before starting the program?

Thank you!



Yes, in the configuration window there is a section “Before launch”. You need to add “Build” in there.


My colleague and me had a similar problem in Intellij last week. It happened after switching to IntelliJ 2018.2 RC. The issue did not disappear even after switching back to IntelliJ 2018.1.

Burkhard’s suggestion did not help neither. Somehow the run configuration would not save any changes, like adding or removing the “Build” to the “before launch” section.

What finally helped was deactivating the “activate tool window” checkbox in the run configuration. Doing this would resolve the issue consistently for all my run configurations. I assume that afterwards the checkbox can be re-activated, though I didn’t try this.



After reimporting the gradle project the “Build” was removed from the run configurations. Thank you @Wasabi375 for pointing this out! Drive me crazy in the last days!!!




Yeah, I noticed before that this setting sometimes gets reset. I just never figured out why or when.


@Wasabi375: I have to disagree slightly here:
It doesn’t get reset, it is lost!

If I go down to defaults, there the “Build” action is clearly visible. If you the following, you get what I did:’

Disclaimer: Works now on a test project!

  1. Create a new Gradle project, create a main class, execute it and store that run config.
  2. Use the following text as .gitignore file and commit everything to git (and enable the git integration of IntelliJ)
  3. Close the project and delete all files and reset git to the files of the commit git reset --hard <-- How I did it
  4. Open the radle file “as project”
    "The project file <<path to .idea directory>> already exists --> overwrite it
  5. “Delete existing project and import” in the following step
  6. Open the “Commit changes” dialog and revert the deleted run configuration

This might sound not ideal, so feel free to help out with improvements! I guess this caused the problem, but I honestly do not know.

Anyway, thanks for pointing this out, I honestly never noticed this section, but it is great to see what is possible using IntelliJ!