Is there any reason why you are using a unstable version of Ubuntu? You should be using a LTS version (eg 16.04) for stability and performance reasons. Latest stable version of IntelliJ is 2017.2.6 (all editions), where does the 2017.1.3 version come from?
The problems with library import is most likely related either to Kotlin plugin version or IDEA version. Try also using more recent version of Kotlin plugin for example 1.1.51 or 1.1.60.
The reason for 16.10 is that was the latest version when I installed it. Should probably upgrade at some point but usually it’s not such a biggie. The IDEA version I downloaded from Jetbrains website, it was the latest version then.
Kotlin plugin version should be the latest, I think I updated it last week or so. IDEA version is a bit old but I can’t find a proper update package, just something that looks like an entire SW? Should I just copy the contents over the old version (sounds a bit iffy)?
Just realised that 2017.1 was the previous IntelliJ major version so the recent update wouldn’t have shown up since its for the next major version. @makistos - Best to remove the install directory for IntelliJ and install the current version. Next time IntelliJ is started a dialog will pop up asking if you want to import the settings from the previous version, which you will want to do.
Important to note in Linux that multiple versions of the same software (also includes system libraries) can be installed without any major issues unlike Windows.
Well, that went well. Deleted the contents of the IDEA folder. Unpacked contents of the tar.gz file to that dir. Started, told it to import existing configuration. And after that I get:
"Cannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing plugin org.jetbrains.kotlin"
And now it won’t open the project. Or any project for that matter.
Found one log that might give clues from ~/.IdeaIC2017.2/system/log. I saved it to http://sofistes.net/idea.log.
There’s a separate Kotlin plugin for each IDEA version, so if you’ve updated IDEA you need to install a Kotlin plugin for that IDEA. You can open the Plugins dialog, find Kotlin plugin there and update it (or uninstall it and install again).
Ah, would have never figured that out. I thought IDEA can upgrade plugins automatically.
Still doesn’t recognize JavaFX, though. I just installed the plugin, but it didn’t help either. This stops me from debugging the program.
@darksnake The issue isn’t just the right content for a build script, but the entire build/run process. It’s fine to create that build.gradle, but do we use gradle to build? Or gradlew? Then how do we run the executable? For those of us familiar with other languages and build setups, the JVM’s are not the most straightforward and nor are the respective docs and tutorials, despite being incredibly powerful and some of the “best things in Java ecosystem”.
Like the OP, I’m coming from elsewhere with a heavy interest in Kotlin. I’ve been reading and writing a lot for weeks, and only just now am I getting into building beyond just using the compiler, since I need coroutines and external packages. I’ve been in a Gradle-hole for several days without finding a clearly defined path.
I understand your problem. I recently tried to to some simple things in JS ecosystem and cursed every javascript developer ever walking the Earth for terrible tools.
Still, gradle have a very good documentation site with a lot of examples. For starters all you really need is basic Java/Kotlin plugin and Application plugin for those who need an application distribution. Android platform have their own set of tutorials.
@kevlarr try kscript. It is intended to help people who are not java
programmers be productive with kotlin
Maven and gradle are worlds onto themselves and even have multiple books
published about them. Something as complex should not be required learning
to get in the door. Even Kobalt (which is easier to understand than
gradle) is pretty complex for someone accustomed to pip or npm.
So, try Kscript and let us know if that was easier for you
@darksnake That sounds like an appropriate response to the JS world! Will run through those docs again though, I probably missed something.
@pabl0rg Ah it helps knowing that they are actually complex and that I’m not just missing something obvious. Will check out kscript (had not seen that before) for now but would definitely prefer exposure to the real tools.
Unfortunately Gradle doesn’t have an official tutorial. To make matters worse all the unofficial Gradle tutorials are either out of date, or are bad quality. Kobalt doesn’t have a beginner friendly tutorial so that is also an issue.
I think your idea of tutorial is quite different from mine.
Here is a very thorough description of basics. And here is application plugin documentation. And finally, here is the list of quite official tutorials.
And by the way, here is tutorial to build kotlin library using kotlin gradle DSL. It is slightly unorthodox, but it is still there.
Here is a very thorough description of basics. And here is application plugin documentation. And finally, here is the list of quite official tutorials.
Guides and tutorials are two different things. None of the tutorials mentioned are linked in this page.
And by the way, here is tutorial to build kotlin library using kotlin gradle DSL. It is slightly unorthodox, but it is still there.
That tutorial is actually a guide, and version 1.0 of Gradle Kotlin DSL will be released sometime during Q1 2018.
In my opinion kotlin gradle dsl is still less readable than groovy dsl, so I would recommend to stick with default one. You need your build script working, not to write your own program on gradle. As for your first remark, there is still a huge number of tutorials and even free online trainings. Gradle developers are making money on it after all.
I have to agree with makistos. For example, I’ve been attempting to get a kotlin native project running this weekend. I’ve been able to surmise that CLion has support for kotlin native via CMake, but does not speak gradle, and IDEA does not speak CMake. All of the kotlin native samples are written with build.gradle files and not CMake, which CLion auto-generates, while much of the documentation around kotlin seems to be written for kotlin script gradle files. Trying to understand these snippets of partial documentation and three different build systems has been an adventure, to put it mildly.
I am somewhat familiar with gradle for android and java but the current state of documentation and examples is untenable.
Well Kotlin Native is still in a early alpha stage so it is not surprising that the tools and documentation for it are still lacking. Also I think if you want to start a discussion about the information to get started with kotlin native we should do this in a new topic as it does not really fit here and this topic is quite long already.
I have read through this thread with interest, I also found the troubleshooting suggestions on Stackoverflow useful, Ive added a comment here that might help others also jvm - Kotlin unresolved reference in IntelliJ - Stack Overflow