How do I succesfully create a new project for Kotl...
# getting-started
k
How do I succesfully create a new project for Kotlin/Native? If I generate a new project in IntelliJ Idea it generates a build.gradle.kts that cannot be built, it just throws the error:
Copy code
Plugin [id: 'org.jetbrains.kotlin.multiplatform'] was not found in any of the following sources:
and every line in the buildscript is underlined in red.
My biggest gripe with doing anything kotlin is gradle, as it's impossible to get it set up correctly. I'd rather just write code instead of debug the build system for hours every time I create a project.
v
If IntelliJ is generating non-working project templates, don't blame it on Gradle. It is not impossible to set up a Gradle project correctly, I any many others do this constantly without any major problem. Also, if you don't like Gradle, noone forces you to use it. You will just then learn what PITA really means. 😄
s
e.g. if you prefer Maven here's how to configure Kotlin for that: https://kotlinlang.org/docs/maven.html (at my current company we use Maven for all the old projects that originally were written in Java. The only downside I can see is that since Gradle is the primary build tool for Kotlin, sometimes there's a plugin for Gradle for some libary but no plugin for Maven yet.)
the multiplatform plugin is hosted on maven repository, so it's a bit strange that you can't find it. Maybe you have a Nexus or some other server between your computer and Maven Repository??
k
Thank you for your opinion but this doesn't help me get a project setup. If the fault is with IntelliJ, what do you suggest using instead? I don't have any proxies, etc. on my connection and anything else using maven repos works just fine, it's just gradle & kotlin on intelliJ that is failing to get anything done.
v
If the fault is with IntelliJ, what do you suggest using instead?
I would never suggest using any other IDE as IntelliJ is the best you can get. Whether the error is in IntelliJ I don't know, as you also did not really say how you created the project. I don't even see an option in IntelliJ to create a K/N project. What is the actual full error? Can you share a build
--scan
?