javalin-websocket-example
javalin-websocket-example copied to clipboard
Does not build on gradle6 and jdk8 or jdk11.
I ran gradle build :
$gradle build
FAILURE: Build failed with an exception.
* What went wrong:
java.lang.ExceptionInInitializerError (no error message)
> org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(java.lang.String,org.gradle.api.internal.file.FileResolver,org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 28s
$gradle --version
------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------
Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 13.0.2 (Oracle Corporation 13.0.2+8)
OS: Mac OS X 10.14.4 x86_64
$java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
I tried with jdk8 as well:
$java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)
The same error occurred - will not copy it again.
I updated the kotlin version in the build.gradle.kts to 1.3.71. This helped quite a bit: it did get much further. But wow a litany of new errors.
gradle build
> Task :compileKotlin FAILED
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
/Users/steve/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.2.61/b0ffdd7ab0bae086a50816e55d94e298311d4c88/kotlin-stdlib-jdk8-1.2.61.jar (version 1.2)
/Users/steve/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.2.61/bc77c34ff80df88b4d9b0418ea4ae758544573f3/kotlin-stdlib-jdk7-1.2.61.jar (version 1.2)
/Users/steve/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.71/898273189ad22779da6bed88ded39b14cb5fd432/kotlin-stdlib-1.3.71.jar (version 1.3)
/Users/steve/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.71/e71c3fef58e26affeb03d675e91fd8abdd44aa7b/kotlin-stdlib-common-1.3.71.jar (version 1.3)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (4, 29): Unresolved reference: WsContext
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (11, 49): Unresolved reference: WsContext
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (15, 20): Too many arguments for public open fun create(): Javalin! defined in io.javalin.Javalin
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (16, 9): Unresolved reference: it
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (24, 24): Type mismatch: inferred type is (???) -> Unit but CloseHandler was expected
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (24, 26): Cannot infer a type for this parameter. Please specify it explicitly.
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (29, 16): None of the following functions can be called with the arguments supplied:
public final fun onMessage(p0: (WsSession!, Array<(out) Byte!>!, Int, Int) -> Unit): Unit defined in io.javalin.websocket.WsHandler
public final fun onMessage(p0: (WsSession!, String!) -> Unit): Unit defined in io.javalin.websocket.WsHandler
public open fun onMessage(p0: BinaryMessageHandler): Unit defined in io.javalin.websocket.WsHandler
public open fun onMessage(p0: MessageHandler): Unit defined in io.javalin.websocket.WsHandler
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (29, 28): Cannot infer a type for this parameter. Please specify it explicitly.
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (38, 55): Cannot choose among the following candidates without completing type inference:
public inline fun <T> Iterable<???>.forEach(action: (???) -> Unit): Unit defined in kotlin.collections
public inline fun <K, V> Map<out ???, ???>.forEach(action: (Map.Entry<???, ???>) -> Unit): Unit defined in kotlin.collections
e: /git/javalin-websocket-example/src/main/kotlin/app/Chat.kt: (38, 65): Cannot infer a type for this parameter. Please specify it explicitly.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 25s
1 actionable task: 1 executed
I then updated the javalin version to 3.8 this builds I will do a PR
https://github.com/tipsy/javalin-websocket-example/pull/3