Thread
#multiplatform
    Mars

    Mars

    2 years ago
    Hello there, am I right in thinking that adding jvm target like so
    kotlin {
      jvm()
    }
    would create
    jvmMain
    source set? I then declare dependencies for the source set in the following way
    jvm().compilations["main"].defaultSourceSet {
        dependsOn(commonMain)
        dependencies {
        ...
        }
    }
    but I can't make this very simple project run. I'm getting
    SourceSet with name 'jvmMain' not found.
    For details, please check:https://stackoverflow.com/questions/62132959/sourceset-with-name-jvmmain-not-found
    christophsturm

    christophsturm

    2 years ago
    what gradle task do you run?
    this looks strange to me: Initialization script '/private/var/folders/yc/sdfads/T/Home_main__.gradle' line: 20
    Mars

    Mars

    2 years ago
    I'm hitting the play button with Java application run configuration. Set to run the Main class with the classpath of module
    jvmMain
    .
    christophsturm

    christophsturm

    2 years ago
    your gradle build file looks ok. what happens when you run
    ./gradlew build
    ?
    Mars

    Mars

    2 years ago
    Oh, no, this one again
    * What went wrong:
    Execution failed for task ':compileKotlinJvm'.
    > kotlin/coroutines/Continuation
    Not sure that's related though, happens every once in a while. I think deleting gradle cache helps. Let me try to fix this and run
    build
    .
    christophsturm

    christophsturm

    2 years ago
    you could try to change
    jvm()
    to
    jvm {
        withJava()
    }
    Mars

    Mars

    2 years ago
    Building via the hammer icon worked fine before.
    christophsturm

    christophsturm

    2 years ago
    and maybe add the
    application
    plugin
    Mars

    Mars

    2 years ago
    withJava()
    didn't seem to help.
    build
    is successful but running the Java class still results in
    SourceSet with name 'jvmMain' not found.
    When I add
    application
    plugin, build fails with
    A problem was found with the configuration of task ':startScripts'.
    > No value has been specified for property 'mainClassName'.
    I tried to add the property like
    application {
        mainClass.set("Home")
    }
    or add to
    gradle.properties
    but it didn't do the trick.
    I figured how to set the
    mainClassName
    for
    application
    plugin
    jvm().compilations["main"].defaultSourceSet {
        configure<JavaApplication> {
            mainClassName = "Home"
        }
    It builds successfully now but
    run
    fails with
    > Process 'command '/Java/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 134
    Makes me think that the problem could be in the run configuration.. do you think this looks okay?
    christophsturm

    christophsturm

    2 years ago
    the module name is pretty long, but it all looks ok