Location of platform jars for proguard gradle task


Hi all,


My question is basically the same as the one here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009520160-Is-there-programmatic-way-to-reference-the-version-of-Intellij-Idea-that-s-downloaded-with-intellij-gradle-plugin-

I'm using the 0.4.22 version of the IJ gradle and now try to include proguard in the build. But some class can not be obfuscated. The proguard task needs access to all the jars on the classpath of the project to do its work.  For classes which have IJ import I get messages similar to the one below:

: can't find referenced class com.intellij.openapi.components.ServiceManager

This is because it can't access the IJ platform jars. In the task I use:

task myProguardTask(type: proguard.gradle.ProGuardTask, dependsOn: 'jar') {
// other lines left out
libraryjars configurations.findByName('runtimeClasspath').getFiles()

The runtimeClasspath does NOT contain the IJ jars. But the compileClasspath does. So I changed the task to contain:

libraryjars configurations.findByName('compileClasspath').getFiles()

But now I run into my limited understanding of Gradle (newbie). I now get the error below.  Is this a Gradle 101 mistake, something specific to the IJ Gradle plugin I have no idea :( Is there a way to obtain the location of the IJ jars, maybe correct way?  My plan-B would be to look in my local dirs for those jars but that would not make for a "portable" build. Any input would be much appreciated.



* What went wrong:
A problem occurred configuring root project 'my-intellij-plugin'.
> Cannot change dependencies of configuration ':idea' after it has been included in dependency resolution.


Comment actions Permalink

Johan, can you please begin with upgrading the Gradle IntelliJ Plugin and Gradle itself to the latest version?


Comment actions Permalink

Great, that did the trick! Thanks Jakub






Please sign in to leave a comment.