Home > Software engineering >  IntelliJ Kotlin build does nothing
IntelliJ Kotlin build does nothing

Time:09-12

I have seen the following issue repeatedly while building multiple Kotlin projects using IntelliJ IDEA Ultimate Build #IU-222.3739.54 (August 2022) and Kotlin plugin 222-1.7.10-release-334-IJ3739.54:

After making a change to existing sources and attempting to run a functional test I get an error such as:

Kotlin: Cannot find a parameter with this name: plan_type

The change I just made was adding the said enumeration to an existing enum class. Checking the logs I see mention of the alleged compilation error that gets displayed in the IDE:

2022-09-06 18:03:51,521 [1573161]   INFO - #c.i.c.ComponentStoreImpl - Saving appEditorSettings took 15 ms, FileTypeManager took 14 ms
2022-09-06 18:04:14,831 [1596471]   INFO - #c.i.c.i.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2022-09-06 18:04:15,975 [1597615]   INFO - #c.i.c.s.BuildManager - Using preloaded build process to compile /Users/lexluthor/Workspaces/billing-service
2022-09-06 18:04:15,994 [1597634]   INFO - #o.j.k.i.s.r.KotlinCompilerReferenceIndexStorage - KCRI storage is closed
2022-09-06 18:04:16,013 [1597653]   INFO - #c.i.c.b.CompilerReferenceServiceBase - backward reference index reader is closed
2022-09-06 18:05:33,532 [1675172]   INFO - #o.j.k.i.s.r.KotlinCompilerReferenceIndexStorage - KCRI storage is opened: took 50 ms for 1 storages (filling map: 47 ms, flush to storage: 3 ms)
2022-09-06 18:05:33,551 [1675191]   INFO - #c.i.c.b.CompilerReferenceServiceBase - backward reference index reader is opened
2022-09-06 18:05:33,886 [1675526]   INFO - #c.i.c.i.CompilerUtil -      COMPILATION FINISHED (BUILD PROCESS); Errors: 1; warnings: 0 took 79046 ms: 1 min 19sec
2022-09-06 18:05:34,264 [1675904]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /Users/lexluthor/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.3739.54/IntelliJ IDEA.app/Contents/plugins/java/lib/jps-launcher.jar
2022-09-06 18:05:46,991 [1688631]   INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=billing-service, containerState=COMPONENT_CREATED, componentStore=/Users/lexluthor/Workspaces/billing-service)RunManager took 18 ms

COMPILATION FINISHED (BUILD PROCESS); Errors: 1

There doesn't appear to be any mention of the said error anywhere else in the log output. Here's some additional observations I have made:

  • The issue only occurs when building a Kotlin project using Gradle and the language version is 1.7.0 or 1.7.10. The issue does not occur if I set the language version to either 1.6.21 or 1.7.20-Beta.
  • The issue only occurs when using the IntelliJ IDEA builder under Gradle Settings: Preferences | Build, Execution, Deployment | Build Tools | Gradle | Gradle Projects | Build and run | Build and run using. Switching to the Gradle builder in the aforementioned settings allows me to build the project without any errors. Subsequently switching back to the IntelliJ IDEA builder after a successful Gradle build appears to fix the issue in the IDE.
  • The issue cannot be easily reproduced on a trivial project. I have not been able to reproduce the issue using a demo project generated using Spring Initilzr but I experience this issue frequently while making trivial changes to existing, medium-size, Kotlin projects and the previous two conditions are met.

I have searched the issue in JetBrains YouTrack without success..

CodePudding user response:

I received an answer to this question from JetBrains technical support that I thought of sharing here for the benefit of anyone else who has come across this issue:

From my checking, your issue looks the same as the https://youtrack.jetbrains.com/issue/KT-53168/ There is a bug in the incremental compilation which is fixed in the 1.7.20-Beta.

You could use the 1.7.20-Beta for it currently or use other workarounds (like Gradle builder)

  • Related