Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plugins {
- id 'java'
- id 'application'
- // shadow plugin to produce fat JARs
- id 'com.github.johnrengelman.shadow' version '7.1.2'
- }
- repositories {
- mavenCentral()
- maven {
- url "https://repository.apache.org/content/repositories/snapshots"
- mavenContent {
- snapshotsOnly()
- }
- }
- }
- group = 'com.maker'
- version = System.getenv('VERSION')
- mainClassName = "${group}.Main"
- description = "Maker"
- ext {
- javaVersion = '15'
- flinkVersion = '1.15.1'
- }
- sourceCompatibility = javaVersion
- targetCompatibility = javaVersion
- tasks.withType(JavaCompile) {
- options.encoding = 'UTF-8'
- }
- configurations {
- flinkShadowJar // dependencies which go into the shadowJar
- // always exclude these (also from transitive dependencies) since they are provided by Flink
- flinkShadowJar.exclude group: 'org.apache.flink', module: 'force-shading'
- flinkShadowJar.exclude group: 'com.google.code.findbugs', module: 'jsr305'
- flinkShadowJar.exclude group: 'org.slf4j'
- flinkShadowJar.exclude group: 'org.apache.logging.log4j'
- }
- dependencies {
- // --------------------------------------------------------------
- // `implementation`:
- // Compile-time dependencies that should NOT be part of the
- // shadow jar and are provided in the lib folder of Flink
- // --------------------------------------------------------------
- implementation "org.apache.flink:flink-java:${flinkVersion}"
- implementation "org.apache.flink:flink-streaming-java:${flinkVersion}"
- implementation "org.apache.flink:flink-table-api-java:${flinkVersion}"
- implementation "org.apache.flink:flink-table-api-java-bridge:${flinkVersion}"
- implementation "org.apache.flink:flink-clients:${flinkVersion}"
- implementation "org.apache.logging.log4j:log4j-slf4j-impl:2.17.1"
- implementation "org.apache.logging.log4j:log4j-api:2.17.1"
- implementation "org.apache.logging.log4j:log4j-core:2.17.1"
- testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
- // --------------------------------------------------------------
- // `flinkShadowJar`:
- // Dependencies that should be part of the shadow jar, e.g.
- // connectors. These must be in the flinkShadowJar configuration!
- // --------------------------------------------------------------
- flinkShadowJar 'com.google.guava:guava:31.1-jre'
- flinkShadowJar 'org.postgresql:postgresql:42.4.0'
- flinkShadowJar "org.apache.flink:flink-sql-connector-kafka:${flinkVersion}"
- flinkShadowJar "org.apache.flink:flink-connector-kafka:${flinkVersion}"
- flinkShadowJar "org.apache.flink:flink-connector-jdbc:${flinkVersion}"
- }
- sourceSets {
- main.compileClasspath += configurations.flinkShadowJar
- main.runtimeClasspath += configurations.flinkShadowJar
- test.compileClasspath += configurations.flinkShadowJar
- test.runtimeClasspath += configurations.flinkShadowJar
- javadoc.classpath += configurations.flinkShadowJar
- }
- run.classpath = sourceSets.main.runtimeClasspath
- application {
- mainClass = "${mainClassName}"
- }
- applicationDefaultJvmArgs = ["-Dlog4j.configurationFile=log4j2.properties"]
- tasks.named('test') {
- useJUnitPlatform()
- }
- jar {
- manifest {
- attributes "Main-Class": "${mainClassName}",
- "Built-By": System.getProperty("user.name"),
- "Build-Jdk": System.getProperty("java.version")
- }
- }
- shadowJar {
- configurations = [project.configurations.flinkShadowJar]
- }
Advertisement
Add Comment
Please, Sign In to add comment