1

I have an Intellij plugin I built using the template https://github.com/JetBrains/gradle-intellij-plugin

My action:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup Java
        uses: actions/setup-java@v3
        with:
          distribution: zulu
          java-version: 11
          cache: gradle

      - name: Plugin
        env:
          CI_BUILD_PLUGIN: true
          DEFAULT_JVM_OPTS: "-Xmx5g -Xms5g"
          GRADLE_OPTS: "-Dkotlin.daemon.jvm.options=-Xmx5G"
        run: |
          ./gradlew check
          ./gradlew runPluginVerifier

When running ./gradlew check in Github Actions, I'm getting Java heap space error:

Execution failed for task ':compileKotlin'.
See the complete report at file:///home/runner/work/xxx/plugins/intellij-platform/build/reports/configuration-cache/avgk7hbsu56pccc278todq8le/5a6oh43i8gcje908b7bopoqxi/configuration-cache-report.html
7 actionable tasks: 7 executed
> Could not resolve all files for configuration ':detachedConfiguration1'.
   > Failed to transform app.jar to match attributes {artifactType=classpath-entry-snapshot, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for ClasspathEntrySnapshotTransform: /home/runner/.gradle/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/ideaIC/2022.3.1/2a2986db4e11c3d378b4d1c8b9fd040cd6d99802/ideaIC-2022.3.1/lib/app.jar.
         > Java heap space

As Github runner has 7GB memory, I'm doubting very much its reaching that limit. Moreover, running locally doesn't incur such memory usage.

I tried to set JVM heap as you can see in the action yaml, but it didn't have any effect.

This heap error is only reproduced for build with platform version 2022.3.1+ , I'm assuming they just go over the default heap limit.

Is there any configuration I'm missing?

Mugen
  • 8,301
  • 10
  • 62
  • 140
  • 2
    please output this https://stackoverflow.com/q/12797560/367456 _during_ your gradle build and [edit] it into your question. – hakre Apr 23 '23 at 08:22

1 Answers1

3

This seems to be a somewhat known problem, starting with org.jetbrains.kotlin.jvm version 1.8.20.

You should be able to up the heap in gradle.properties, like so: org.gradle.jvmargs=-Xmx4g -Xms1g.

Alternatively, you can disable incremental compilation like so: kotlin.incremental.useClasspathSnapshot=false

Either one of the two modifications should fix the problem.

Nils
  • 9,682
  • 6
  • 46
  • 72
  • 1
    Seems to be addressed by JB too https://github.com/JetBrains/intellij-platform-plugin-template/commit/6e4a928bbe922e9cb584f8f94b7c05d28d7ac65e Thanks! – Mugen Apr 30 '23 at 10:19