takari / polyglot-maven

Support alternative markup for Apache Maven POM files
Eclipse Public License 1.0
893 stars 101 forks source link

Unable to compile kotlin when using polyglot-kotlin extension #214

Closed thorntonrp closed 3 years ago

thorntonrp commented 4 years ago

I created PR #213 to resolve an issue when using the polyglot-kotlin extension in combination with version 1.4.0 of the kotlin maven compiler plugin. This pull request upgrades the polyglot-kotlin extension to use Kotlin 1.4.0 which was released on August 17. When projects using version 1.4.0 of the kotlin maven compiler plugin attempt to compile their kotlin source code, the compiler plugin gets the following exception:

java.lang.NoSuchMethodError: 'kotlin.sequences.Sequence kotlin.sequences.SequencesKt.flatMapIterable(kotlin.sequences.Sequence, kotlin.jvm.functions.Function1)'

While debugging, I determined that the above compiler exception only happens with projects using both the polyglot-kotlin extension and Kotlin 1.4.0. Upgrading the polyglot-kotlin extension to use Kotlin 1.4.0 fixes this issue.

vonZeppelin commented 4 years ago

I faced the same error - would be great for PR #213 being merged and this issue fixed.

vonZeppelin commented 4 years ago

BTW, I think this issue shouldn't have happened in the first place - (polyglot-kotlin) extension's classpath and project's classpath should be isolated from each other, otherwise this issue might occur again even after the fix is merged.

Don't know whether it's easy to fix on Maven plugins / extensions level (maybe it's a simple configuration setting change?), but I think what can definitely help is to use Kotlin dependencies as shaded dependencies by the polyglot-kotlin extension.

mosabua commented 3 years ago

Fix with merged PR