abhinay
08/28/2018, 1:21 PMCzar
08/28/2018, 1:25 PMabhinay
08/28/2018, 1:31 PMCzar
08/28/2018, 1:32 PMCzar
08/28/2018, 1:33 PMabhinay
08/28/2018, 1:33 PMabhinay
08/28/2018, 1:34 PMCzar
08/28/2018, 1:35 PMabhinay
08/28/2018, 1:36 PMbuild.gradle
?abhinay
08/28/2018, 1:37 PMCzar
08/28/2018, 1:39 PMe: Module javafx.controls cannot be found in the module graph
Czar
08/28/2018, 1:39 PMimport org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`java-library`
kotlin("jvm")
kotlin("plugin.spring")
id("org.springframework.boot")
id("io.spring.dependency-management") version "1.0.6.RELEASE"
}
group = "com.example"
version = "1.0-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_1_10
targetCompatibility = JavaVersion.VERSION_1_10
}
tasks.withType<Wrapper> {
gradleVersion = "4.10"
distributionType = Wrapper.DistributionType.ALL
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
repositories {
jcenter()
maven(url = "<https://repo.spring.io/libs-milestone>")
}
dependencies {
listOf(
kotlin("stdlib-jdk8"),
kotlin("reflect"),
springBoot("starter")
).forEach { implementation(it) }
}
fun springBoot(module: String, version: String = "") = "org.springframework.boot:spring-boot-$module:$version"
Czar
08/28/2018, 1:42 PMmodule com.example {
requires kotlin.stdlib;
requires kotlin.stdlib.jdk8;
requires spring.core;
requires spring.boot.autoconfigure;
requires spring.boot;
requires spring.context;
requires javafx.controls;
opens com.example to spring.core;
exports com.example;
}
abhinay
08/28/2018, 1:47 PMCzar
08/28/2018, 2:04 PMCzar
08/28/2018, 2:23 PMval compileJava: JavaCompile by tasks
compileJava.apply {
dependsOn("compileKotlin")
doFirst {
options.compilerArgs = listOf(
"--module-path", classpath.asPath
)
classpath = files()
}
}
abhinay
08/28/2018, 3:04 PMrequires kotlin.stdlib;
in module-info.java
?abhinay
08/28/2018, 3:13 PMCzar
08/28/2018, 3:17 PMrequires
statements except javafx and tornadofx and the app still works. I wonder why...Czar
08/28/2018, 3:26 PMCzar
08/28/2018, 3:26 PMSymbol is declared in module 'spring.boot.autoconfigure' which current module does not depend on
abhinay
08/28/2018, 3:27 PMmodule-info.class
in the jar. I am sure your other dependencies have the same issue.Czar
08/28/2018, 3:27 PMabhinay
08/28/2018, 3:28 PMCzar
08/28/2018, 3:28 PMCzar
08/28/2018, 3:28 PMabhinay
08/28/2018, 3:43 PM/usr/lib/jvm/java-10-oracle/bin/java -Dfile.encoding=UTF-8 -Duser.language=en -Duser.variant -cp KotlinJPMS/build/classes/java/main:KotlinJPMS/build/classes/kotlin/main:KotlinJPMS/build/resources/main:.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.61/5bc44acc4b3f0d19166ae3e50454b41e8ff29335/kotlin-stdlib-1.2.61.jar:.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.2.61/772de03e12d932f489e41aef997d26c20a4ebee6/kotlin-stdlib-common-1.2.61.jar:.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar xyz.abhinay.Main
Command run by IntelliJ:
/usr/lib/jvm/java-10-oracle/bin/java -javaagent:.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/181.5540.7/lib/idea_rt.jar=32799:.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/181.5540.7/bin -Dfile.encoding=UTF-8 -p Documents/git/random/KotlinJPMS/out/production/classes:.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.2.61/5bc44acc4b3f0d19166ae3e50454b41e8ff29335/kotlin-stdlib-1.2.61.jar:.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.2.61/772de03e12d932f489e41aef997d26c20a4ebee6/kotlin-stdlib-common-1.2.61.jar:.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar -m xyz.abhinay/xyz.abhinay.MainKt
The important difference is gradle uses -cp
referring to classpath where as Intellij uses -p
referring to module-path.abhinay
08/28/2018, 4:09 PMrun {
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--module', mainClassName
]
classpath = files()
}
}
abhinay
08/28/2018, 4:50 PMamanda.hinchman-dominguez
05/26/2019, 11:40 PMabhinay
05/27/2019, 3:53 AMabhinay
05/27/2019, 3:54 AMamanda.hinchman-dominguez
05/27/2019, 3:57 AMabhinay
05/27/2019, 3:57 AMamanda.hinchman-dominguez
05/27/2019, 3:58 AMamanda.hinchman-dominguez
05/27/2019, 3:58 AMamanda.hinchman-dominguez
05/27/2019, 3:58 AMamanda.hinchman-dominguez
05/27/2019, 3:59 AMmodules-info.java
to your projects now? I don’t know if it’s true. I don’t have multiple modules soabhinay
05/27/2019, 3:59 AMmodules-info.java
is not mandatoryamanda.hinchman-dominguez
05/27/2019, 4:04 AMamanda.hinchman-dominguez
05/27/2019, 4:05 AMamanda.hinchman-dominguez
05/27/2019, 4:05 AMamanda.hinchman-dominguez
05/27/2019, 4:05 AMamanda.hinchman-dominguez
05/27/2019, 4:05 AMamanda.hinchman-dominguez
05/27/2019, 4:06 AMabhinay
05/27/2019, 4:11 AMamanda.hinchman-dominguez
05/27/2019, 4:29 AM