Hi everyone, I wrote a kotlin compiler plugin afte...
# compiler
o
Hi everyone, I wrote a kotlin compiler plugin after reading the following article [Writing Your Second Kotlin Compiler Plugin, Part 1 — Project Setup] which seems that only mentions how to create a kotlin compiler plugin that can be used in Gradle, and how to make such a compiler plugin work in Maven has become a problem that bothers me. I read the source code of official plugins such as all-open, but I didn’t find the answer. Do I need to write another maven plugin? What should I do, or is there anything like documentation or guidance? What I am doing: https://github.com/Kronos-orm/Kronos-orm
y
I have an example maven plugin here. I can't quite remember how I did it, but I think it's just a bit of boilerplate that's very similar to the gradle stuff
o
Thanks a lot🙏,I'll check it out!
@Youssef Shoaib [MOD] Hello, friend, the Maven plugin in the example you provided does not work in the [sample-maven] use case, and the null value does not seem to be defaulted. The error I get is
Copy code
Exception in thread "main" java.lang.NullPointerException: Parameter specified as non-null is null: method
MyClass.<init>, parameter name
at MyClass.<init>(Main.kt)
at Main.main(Main.java:6)
at MainKt.main(Main.kt:34)
at MainKt.main(Main.kt)
And I packaged the Maven plugin according to your generous instructions, but got the following error when actually running it:
Copy code
[ERROR] The provided plugin org.jetbrains.kotlin.kapt3.Kapt3ComponentRegistrar is not compatible with this version of compiler.
java.lang.AbstractMethodError: Method org/jetbrains/kotlin/kapt3/Kapt3ComponentRegistrar.registerProjectComponents(Lorg/jetbrains/kotlin/com/intellij/mock/MockProject;Lorg/jetbrains/kotlin/config/CompilerConfiguration;)V is abstract
	at org.jetbrains.kotlin.kapt3.Kapt3ComponentRegistrar.registerProjectComponents(Kapt3Plugin.kt)
y
I might have broken that in some update I'm guessing. I'll try to see what's wrong, but it seems to be a compiler version issue
o
@Youssef Shoaib [MOD] Dear Youssef Shoaib, Hello, have you found the reason why the
maven-sample
in your
kotlin-null-default
project does not work properly? The current example does not seem to achieve the effect of "allows Java callers to pass in null for default parameters by automatically checking for nulls and substituting the default values". I tried to find some ways to explore why the maven plugin does not work, but none of them worked, so I came to you again to try to get some inspiration and advice.
@Youssef Shoaib [MOD]Everything works well after I open "Delegate IDE build/run actions to Maven" and upgrade the version of Kotlin and kotlin-compiler-embeddable.Thank you again for the great help you provided me with the sample project! I think this should be the only guide on the entire network at present!