Jakub Gwóźdź
08/18/2020, 3:26 PM#!/usr/bin/env kotlinc -Xadd-modules=java.sql -script
@file:DependsOn("mysql:mysql-connector-java:8.0.19")
import java.sql.DriverManager
... actual code
now the problem is, that I cannot use AutoCloseable.use { .... }
extension function, because it's not in common/jvm stdlib.
How can I force kotlinc to use -jdk8 stdlib?ilya.chernikov
08/18/2020, 5:10 PMstdlib-jdk8
into the classpath manually (via the -cp
in the hashbang line)Jakub Gwóźdź
08/20/2020, 8:10 AM@file:DependsOn("mysql:mysql-connector-java:8.0.19", "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.0")
as it uses indirect dependencies as well. Good enough for PoC.
The problem is that I needed to specify 1.4.0 inside the script now and I'd prefer not to, as running on 1.4.1 sometime in future will download 1.4.0 instead of using local libs.ilya.chernikov
08/20/2020, 8:14 AMkotlinc
. It would be nice if you'll create an issue on youtrack about it.Jakub Gwóźdź
08/20/2020, 9:17 AM