Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when compiling with IntelliJ instead of Gradle #1

Open
legzo opened this issue Mar 30, 2021 · 3 comments
Open

Error when compiling with IntelliJ instead of Gradle #1

legzo opened this issue Mar 30, 2021 · 3 comments

Comments

@legzo
Copy link

legzo commented Mar 30, 2021

Hi, and thank you for the article and the plugin !

I tried to use your gradle plugin into my current project and it works great when I build the project with gradle, but it fails when I configure IntelliJ IDEA to use the build the project with IJ compiler and not gradle I have the following error :

Capture d’écran 2021-03-30 à 15 23 54

Kotlin: [Internal Error] java.lang.IllegalStateException: The provided plugin me.shika.ObjectSerializationComponentRegistrar is not compatible with this version of compiler
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:592)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerExtensionsFromPlugins(KotlinCoreEnvironment.kt:132)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:172)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:426)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:226)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:152)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1500)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
        (...)
Caused by: java.lang.AbstractMethodError: Receiver class me.shika.ObjectSerializationComponentRegistrar does not define or inherit an implementation of the resolved method 'abstract void registerProjectComponents(com.intellij.mock.MockProject, org.jetbrains.kotlin.config.CompilerConfiguration)' of interface org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar.
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:584)
	... 28 more

I forked the plugin code thinking that I maybe could update the version or something but I don't think I have a clue about what needs to be done here ;)

Could you give me some advice to make the plugin usable in both modes ?

@ShikaSD
Copy link
Owner

ShikaSD commented Mar 31, 2021

Hm, this one is interesting, I suppose Gradle uses kotlin-compiler-embeddable where some classes are ShadowJar'ed, but IDEA doesn't. Not sure what the solution could be unless it is possible to check which runner is currently executing the build and select different Jar's appropriately.

@ShikaSD
Copy link
Owner

ShikaSD commented Mar 31, 2021

I will check how it works with serialization or all-open plugins, but I suspect they are bundled with Kotlin plugin in IDE, whereas mine isn't, so it causes this error :)

@legzo
Copy link
Author

legzo commented Apr 1, 2021

Hi Andrei,

Thanks for the udpate !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants