Upgrading my plugins to 2021.*/Gradle java.lang.NoClassDefFoundError: com/intellij/openapi/compiler/CompileTask

Answered

Hi All

 

After ugrading all my plugins to 2021.* and using gradle, I have this problem:

This code

import com.intellij.openapi.compiler.CompileTask;

is compiled successfully, but on runtime I get

java.lang.NoClassDefFoundError: com/intellij/openapi/compiler/CompileTask

So I added

<depends>com.intellij.java</depends>

And it solves the problem, But I did it without understand why, what is the principle ? 

com.intellij.openapi.compiler.CompileTask is part of the openapi, How can I guess that com.intellij.java is needed ? How do I know for other used classes what plugin is needed ?

Thanks

Boaz

 

 

2 comments
Comment actions Permalink

Hi, Boaz!

This class belongs to the Java module – you can easily verify it by looking at the intellij-community sources:
https://github.com/JetBrains/intellij-community/blob/master/java/compiler/openapi/src/com/intellij/openapi/compiler/CompileTask.java

Note, the leading /java/compiler/openapi

So, to make your plugin working, you have to set the dependency to Java module both in the Gradle configuration, as well as plugin.xml.

For more information, please check the Modules Specific to Functionality docs page.

0

Please sign in to leave a comment.