Open dibog opened 4 years ago
I haven't tried maven yet, but Gradle is using maven repositories, and the artifacts are on google maven repository, it should work out of box on maven. You need to add google maven repository to your project and use artifact ID "org.jetbrains.kotlin:kotlin-symbol-processing-api:1.4-M1-dev-experimental-20200610".
But for using the processors you write in maven, this will be non-trivial as currently there is only gradle plugin support.
Not sure if this falls under the same question but currently i'm using KSP to process some JAXB generated classes:
com.company.codegen:myLibrary:1.0.0
would the KSP generated classes be visible/usable by the consumer of the JAR?
Following up on this. If i package up the XJC generated classes and the KSP generated classes and install the package into my local .m2, then i'm able to access all generated artifacts (XJC and KSP) in both maven and gradle project without modifying the source sets.
@i-walker There is this project in github, which does exactly this. https://github.com/Dyescape/kotlin-maven-symbol-processing I tried it and works and the solution seems easy and clean. I have zero idea how it is done though. My problem is, that I need to add a parameter and I don't find a way to do it. Any ideas?
Thanks @teras it worked fine 🙌🏾
For future reference: it's even possible to add options. The documentation of kotlin-maven-symbol-processing has been updated to demonstrate just this.
@i-walker There is this project in github, which does exactly this. https://github.com/Dyescape/kotlin-maven-symbol-processing I tried it and works and the solution seems easy and clean. I have zero idea how it is done though. My problem is, that I need to add a parameter and I don't find a way to do it. Any ideas?
I haven't tested this myself, but please feel free to close the issue if the solution works. I've ported my projects to gradle and no longer need maven support. Regardless though, i'm happy this works 🙂
Anyone have an existing sample on github?
I am trying to use a custom KSP processor in a Maven project.
But for using the processors you write in maven, this will be non-trivial as currently there is only gradle plugin support.
Is this still true?
And I also tried using kotlin-maven-symbol-processing suggested by @evanchooly However, when I do this, I get the following error:
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:2.0.21:compile (compile) on project XYZ: Compilation failure
[ERROR] There are some plugins incompatible with language version 2.0:
[ERROR] com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar
[ERROR] Please use language version 1.9 or below
This project also seems to be no longer maintained.
The example showed gradle as build tool, how would you use it with maven?