Kotlin plugin problems with 6.0.+ or 0.1-SNAPSHOT


#1

Hi, I'm trying to get the hello world maven application to work. I have plugin 0.6.1558 and IC 12.1.6 . I had the same results with plugin 0.6.605 2 days ago.

I downloaded the example from here https://codeload.github.com/JetBrains/kotlin-examples/zip/master and imported <…>kotlin-examples-mastermavenhello-world as maven project. I get an error in the notification bar:
[…]  kotlin-stdlib-0.1-20131128-266.jar has an unsupported format […]
(An aside: why, oh why, is it not possible to select and copy the text from the notification bar?).

When I try to build I get the following output:
Kotlin: Class ‘kotlin/KotlinPackage’ was compiled with an incompatible version of Kotlin. Its ABI version is 12, expected ABI version is 11

I looked at the repositories and it it looks like the runtime ends in 267 but the std-lib in 266. I’m guessing this might be the source of the error, but I wasn’t able to hardwire maven to get the 266 version of the runtime. Also it wouldn’t have been a very satisfactory solution, having to manually mainpulate every kotlin release :slight_smile:

Things look better when I change the Pom to use kotlin version 0.6.+ instead of the snapshot (This did not work for plugin 0.6.605). Now I can run the application and the test successfully. However the IDE complains about things being missing from the stdlib.
In Hello.kt println is red and when I hover over it, the error popup says (also not able to select and copy… grrr!):
Unresolved reference: println

In HelloTest.kt assertEquals is red both in the code and in the import statement with the same error>
import kotlin.test.assertEquals

As I can build, this is just an annoyance, but a pretty major one :wink:


#2

After all my editing, an error managed to sneak in, and it looks like I can't edit my original post :

I wrote this:
In HelloTest.kt assertEquals is red both in the code and in the import statement with the same error>
import kotlin.test.assertEquals

I meant this:
In HelloTest.kt assertEquals is red both in the code and in the import statement with the same error:
Unresolved reference: assertEquals


#3

Update: When I create a project from scratch, without maven, Intellij asks me to use the runtime from the plugin (or copy it into the project). Nothing similiar happens when I import the maven project.

When I add the runtime library manually to my maven project, println is no longer higlighted with an error. This solves my annoyance.

However, this is not a great solution, as now my project is referencing 2 kotlin runtimes, one from maven and one imported through project settings. I’m quite sure that when something gets updated somewhere, something will break, and hilarity will ensue :wink:


#4

Hi Jon!

I’m using gradle with Kotlin 0.6.+ and the latest intellij Snapshot plugin for kotlin coming from:

http://teamcity.jetbrains.com/guestAuth/repository/download/bt345/.lastSuccessful/updatePlugins.xml

This is for IDEA 13 EAP but there is a snapshot plugin for 12 also.  So far so good but I have experienced incompatibilities when trying to use the “stable” version of the idea plugin.  I would suggest getting intellij to sync with your maven build for builds.

For the Jetbrains folks, could you let us know what is the best way to keep everything in sync?  I don’t mind using the EAP as long as it’s not crashing as Kotlin is expected to be in a constant state of flux.  But it would be good to have a weekly snapshot for all the runtimes and the plugin that are in sync.

-Steve


#5

Unfortunatley, since Kotlin is under development we cannot entirely avoid such compatibility problems for now.

The safest strategy is to use a milestone version (current is M6.1, M7 will be out very soon).

If you want to use nightly builds of the plugin, you will occasionally run into incompatibilities.
Strategies there are:

  • use 0.1-SNAPSHOT version in Maven/Gradle and the latest nightly build of the IntelliJ plugin
  • use the version from Maven closest to the version of your plugin, and ping us so that we push a new version to Central when an incompatibility is encoutered


We would really like to automate this process, but this haven’t happened yet. Sorry for the inconvenience.