ebean-orm-tools / ebean-gradle-plugin

Plugin that performs Enhancement (entity, transactional, query bean) and can generate query beans from entity beans written in Kotlin via kapt
Apache License 2.0
10 stars 12 forks source link

Combining Java & Kotlin fails #18

Closed tobias- closed 5 years ago

tobias- commented 6 years ago

Any Kotlin code that depends on java code will fail. I will append an example shortly where the maven plugin works, but the gradle plugin fails.

Pom from: https://raw.githubusercontent.com/ebean-orm-examples/example-kotlin/master/pom.xml

tobias- commented 6 years ago

https://github.com/tobias-/example-gradle-kotlin/tree/java_and_kotlin_problem

The base issue is that in Gradle, the Kotlin code is enhanced before the Java code has been compiled. Maven seems to do the ebean step after all classes have been compiled . This causes a lot of not found classes during Gradle build, but works with Maven.

This may have a workaround by doing some Gradle trick, but I haven't found it.

tobias- commented 6 years ago

I've made a solution that works for my usecase, but there's bound to be a better way of doing it. Either way, here: https://github.com/tobias-/ebean-gradle-plugin/tree/hacky_fix_for_java_and_kotlin

tobias- commented 6 years ago

Better link https://github.com/tobias-/ebean-gradle-plugin/commit/41c96b26a64ecde60a93b6e9b211dc3b91cfb0fb?w=1

rbygrave commented 5 years ago

Ok, the above change looks like it should be submitted as a PR and included?

rbygrave commented 5 years ago

Ok, made the changes as per the commit above and merged that into master as part of 11.13.1

I'll close this (but would be good for @tobias- to review if possible)