Didn't have luck with this yesterday in <#C0B8MA7F...
# announcements
n
Didn't have luck with this yesterday in #getting-started , thought I'd try here to get more eyes on it: So, I started toy projects in intellij by creating the regular kotlin application. That was fine, but there was no gradle file that I could find so when I wanted to add dependencies to play around with (arrow), I couldn't figure out how to do it. So then I started a new project, and I picked a gradle project (with the build.gradle.kts file) Now, I can see where to add dependencies, but I can't actually build and run main When I try, I get "Error: Could not find or load main class MainKt". Do I need to add targets to the gradle file? I have sourceSets already...
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    kotlin("jvm") version "1.4.0"
    kotlin("kapt") version "1.4.0"
}

group = "FooBarBaz"
version = "1.0-SNAPSHOT"



repositories {
    mavenCentral()
    jcenter()
    maven ("<https://dl.bintray.com/arrow-kt/arrow-kt/>" )
}

val arrow_version = "0.10.5"

dependencies {
    implementation(kotlin("stdlib-jdk8"))
    implementation(kotlin("io.arrow-kt:arrow-optics:$arrow_version"))
    implementation(kotlin("io.arrow-kt:arrow-syntax:$arrow_version"))
    implementation(kotlin("io.arrow-kt:arrow-optics:$arrow_version"))
    //kapt("io.arrow-kt:arrow-meta:$arrow_version")
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}
sourceSets.main {
    java.srcDirs("src/main/java", "src/main/kotlin")
}
My hello world file is in 
src/main/kotlin/main.kt
e
this looks like it sets up a java library module
what are you running?
n
what do you mean by "what am I running" ?
I also tried to setup a new gradle project, btw. And then it immediately fails once the project is created, to sync gradle. I have a red message "Unable to get Gradle home directory", and another error "Protocol message contained an invalid tag (zero)"
e
if you had
Copy code
plugins {
    application
}
application {
    mainClassName = "MainKt"
}
then you could run
./gradlew run
, for example
I don't see where how you're trying to execute main
or do you not have a gradle wrapper set up??
n
I'm only executing things via the IDE
I hit the little "play" button beside main
e
never did like IDEs… vim and command line all the way
but check the configuration
there should be something in the UI saying "use classpath of module" and "before launch: build"
n
I don't see anything like that
e
just to check, you do have gradle wrapper set up, right?
n
I'm not sure
I literally just created a new gradle project in the IDE
and then edited the build.gradle.kts file mostly from there
I'm honestly confused, why this is so hard to setup a working project from an IDE, for a language coming from an IDE company
When I create a new project as well, the gradle version is 4.10.3 by default, which is too old to work with this version of kotlin?!? So i have to change something to make it work...
had to feed the path to gradle 6.6.1 in the gradle-wrapper.properties
n
I created a new Kotlin Gradle project this weekend and it defaulted to Gradle 6.4 I think. you're running the latest IntelliJ?
n
Yeah I upgraded intellij, I thought I already had
I hope that helps with some of these things