Skip to content

Instantly share code, notes, and snippets.

@skhatri
Created June 4, 2024 13:52
Show Gist options
  • Save skhatri/770765a827f436dedc201808e5a47e50 to your computer and use it in GitHub Desktop.
Save skhatri/770765a827f436dedc201808e5a47e50 to your computer and use it in GitHub Desktop.
java17 module permissions
plugins {
id("java")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-script-runtime:1.9.0")
}
}
dependencies {
implementation(project(":dataset"))
implementation("org.apache.hadoop:hadoop-aws:3.3.6")
implementation("ch.qos.logback:logback-classic:1.5.3")
implementation("net.logstash.logback:logstash-logback-encoder:7.4")
implementation("org.xerial:sqlite-jdbc:3.45.3.0")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0")
implementation("org.apache.calcite:calcite-core:1.36.0")
listOf("flink-streaming-java",
"flink-parquet", "flink-clients", "flink-connector-files",
"flink-table-planner-loader",
"flink-csv",
"flink-table-runtime",
"flink-json",
"flink-table-api-java-bridge"
).forEach {
implementation("org.apache.flink:${it}:1.19.0")
}
implementation("org.apache.flink:flink-connector-kafka:3.1.0-1.18")
implementation("org.apache.kafka:kafka_2.12:3.7.0")
implementation("org.apache.hadoop:hadoop-common:3.4.0")
implementation("org.apache.hadoop:hadoop-hdfs:3.4.0")
implementation("org.apache.hadoop:hadoop-mapreduce-client-core:3.4.0")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.1")
}
val targetApp = "flink.${project.ext["name"]}"
val appArgs = "${project.ext["app-args"]}".split(" ").filter { x -> x != "" }
task("runTask", JavaExec::class) {
mainClass = "${targetApp}"
classpath = sourceSets["main"].runtimeClasspath
jvmArgs = listOf(
"-Xms512m", "-Xmx1024m", "-XX:+UseZGC",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-exports=java.base/sun.util.calendar=ALL-UNNAMED",
)
args = appArgs
}
repositories {
mavenCentral()
}
tasks.register<Copy>("copyToLibs") {
from(configurations.compileClasspath)
into("$buildDir/libs")
}
tasks.named<Jar>("jar") {
dependsOn("copyToLibs")
manifest {
attributes["Main-Class"] = targetApp
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment