The actual error is a bit too long for the subject:
Cannot cast org.jetbrains.jps.model.serialization.java.JpsJavaModelSerializerExtension to org.jetbrains.jps.model.serialization.JpsModelSerializerExtension
I'm trying to write compiler extension but run into this weird classloading related issue. I suppose the two JpsModelSerializerExtension classes got loaded by different classloaders and therefore are not the same causing the cast to fail. But why this happens so deep inside IJ is too difficult for me.
My plugin.xml boils down to the snippet below. I had to add <depends>com.intellij.java</depends> otherise the CompileServerPlugin was not found.
I wonder now whether this issue I reported here : https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009534980--Gradle-buildPlugin-packages-maven-test-scoped-deps-550K-plugin-jar-becomes-20M Unfortunately unanswered so far.The Gradle build puts many jars including the jps-model-*.jar files (and maven aether-*.jar libs too!) in the lib dir of the plugin. I would think this is not needed. But this could explain why the JpsModelSerializerExtension class get loaded again.
ps: at the risk of sounding negative - this recommended Gradle based plugin creation is not a great experience so far. The DevKit way, a few years ago, was a bit smoother.
<!-- Add your extensions here -->
<compileServer.plugin classpath="exceptional-1.0-SNAPSHOT.jar;exceptional-jps-plugin-1.0-20200818.173223-1.jar" />