Hello there, am I right in thinking that adding jv...
# multiplatform
m
Hello there, am I right in thinking that adding jvm target like so
Copy code
kotlin {
  jvm()
}
would create
jvmMain
source set? I then declare dependencies for the source set in the following way
Copy code
jvm().compilations["main"].defaultSourceSet {
    dependsOn(commonMain)
    dependencies {
    ...
    }
}
but I can't make this very simple project run. I'm getting
Copy code
SourceSet with name 'jvmMain' not found.
For details, please check: https://stackoverflow.com/questions/62132959/sourceset-with-name-jvmmain-not-found
c
what gradle task do you run?
this looks strange to me: ``Initialization script '/private/var/folders/yc/sdfads/T/Home_main__.gradle' line: 20``
m
I'm hitting the play button with Java application run configuration. Set to run the Main class with the classpath of module
jvmMain
.
c
your gradle build file looks ok. what happens when you run
./gradlew build
?
m
Oh, no, this one again
Copy code
* 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
.
c
you could try to change
jvm()
to
Copy code
jvm {
    withJava()
}
m
Building via the hammer icon worked fine before.
c
and maybe add the
application
plugin
m
withJava()
didn't seem to help.
build
is successful but running the Java class still results in
Copy code
SourceSet with name 'jvmMain' not found.
When I add
application
plugin, build fails with
Copy code
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
Copy code
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
Copy code
jvm().compilations["main"].defaultSourceSet {
    configure<JavaApplication> {
        mainClassName = "Home"
    }
It builds successfully now but
run
fails with
Copy code
> 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?
c
the module name is pretty long, but it all looks ok