This will download all the dependency jars (and in turn their dependencies too) into the current directory. You need to blank settings.gradle
file in the same directory. It works with gradle 7.
apply plugin: 'application'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.xerial:sqlite-jdbc:3.40.0.0'
}
task copyToLib(type: Copy) {
into "."
from configurations.runtimeClasspath
}
build.dependsOn(copyToLib)
Then run gradle build
.
Here's a basic build.gradle
file you need to compile kotlin. It can go in a directory with a blank settings.gradle
file.
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.0'
id 'application'
}
repositories {
mavenCentral()
}
sourceSets {
main.kotlin.srcDirs = ['src']
}
compileKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
application {
mainClass = 'demo.AppKt'
}
Then in src/ we can put
package demo
class App {}
fun main() {
println("Hello")
}
Then gradle build run
will build and run your application.
You can attempt to reduce the amount of RAM the gradle daemon uses, the thing that makes kotlin compilation not horrifically slow, with export GRADLE_OPTS="-Xmx64m -Dorg.gradle.jvmargs='-Xmx256m -XX:MaxMetaspaceSize=256m'"
&filetype
will return something like java
or javascript
. So this will work
if (&filetype == "java")
" whatever you want
endif
There's a src.zip
file in /usr/lib/jvm/jdk-17/lib
. We can list all the files in this to extract the java imports.
unzip -l src.zip |
awk '{ print $4 }' |
sed 's/[^/]*\///' |
grep -v module-info |
grep -v package-info |
sed 's/\.java$//' |
tail -n +4 |
sed '/^$/d' |
sed 's/\//./g'