Skip to content

Commit f12da48

Browse files
authored
Update log4j used by schema sample app to 2.17 (#81)
* Update log4j used by schema sample app to 2.17.+ * Update gradle.build Co-authored-by: Adrian Preston @prestona
1 parent ed6d440 commit f12da48

File tree

3 files changed

+19
-62
lines changed

3 files changed

+19
-62
lines changed

kafka-java-console-schema-sample/build.gradle

+12-55
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
// Licensed Materials - Property of IBM
1818
// © Copyright IBM Corp. 2015-2018
1919
//
20-
2120
plugins {
2221
id 'application'
2322
id 'java'
24-
id 'com.github.johnrengelman.shadow' version '4.0.2'
23+
id 'com.github.johnrengelman.shadow' version '7.1.0'
2524
id 'eclipse'
26-
id 'com.commercehub.gradle.plugin.avro' version '0.21.0'
25+
id "com.github.davidmc24.gradle.plugin.avro" version "1.3.0"
2726
}
2827

2928
group = 'com.ibm.eventstreams.samples'
@@ -42,68 +41,26 @@ repositories {
4241

4342
dependencies {
4443
implementation 'org.apache.kafka:kafka-clients:2.7.+'
45-
implementation 'log4j:log4j:1.2.17'
46-
implementation 'org.slf4j:slf4j-log4j12:1.7.25'
44+
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.+'
45+
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.+'
46+
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.17.+'
4747
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.+'
48-
implementation 'io.confluent:kafka-avro-serializer:5.3.+'
49-
implementation 'org.apache.avro:avro:1.10.+'
50-
}
51-
52-
task downloadDependencies(type: Exec) {
53-
configurations.testRuntimeClasspath.files
54-
commandLine 'echo', 'Downloaded all dependencies'
48+
implementation 'io.confluent:kafka-avro-serializer:6.2.+'
49+
implementation 'org.apache.avro:avro:1.11.+'
5550
}
5651

57-
task generateAvro(type: com.commercehub.gradle.plugin.avro.GenerateAvroJavaTask) {
58-
source("src/main/avro")
59-
outputDir = file("build/generated/sources/avro/java/main/resources")
60-
}
61-
62-
// compileJava.source(generateAvro.outputs)
6352
avro {
6453
createSetters = false
6554
fieldVisibility = "PRIVATE"
6655
}
6756

68-
// Compile source code
69-
compileJava {
70-
doFirst {
71-
copy {
72-
from configurations.runtimeClasspath
73-
into 'lib'
74-
}
75-
}
76-
77-
source = ['src', generateAvro.outputs]
78-
options.encoding = 'ISO-8859-1'
79-
}
80-
8157
jar {
58+
archiveClassifier.set('no-deps')
59+
}
60+
shadowJar {
8261
from "resources/log4j.properties"
83-
84-
doLast {
85-
copy {
86-
from 'resources'
87-
into 'build/libs/resources'
88-
}
89-
90-
copy {
91-
from 'lib'
92-
into 'build/libs/lib'
93-
}
94-
}
95-
96-
// Provide Main-Class so the JAR executes properly, along with the required classpath data.
62+
archiveClassifier.set('')
9763
manifest {
98-
attributes('Main-Class': mainClassName,
99-
'Class-Path': configurations.runtimeClasspath.files.collect { './lib/' + it.name }.join(' '))
64+
attributes('Main-Class': mainClassName)
10065
}
10166
}
102-
103-
sourceSets {
104-
main {
105-
java {
106-
srcDirs = ["src/main/java", "src/main/resources"]
107-
}
108-
}
109-
}

kafka-java-console-schema-sample/src/main/resources/log4j.properties

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rootLogger.level=info
2+
rootLogger.appenderRef.console.ref=STDOUT
3+
4+
appender.console.type=Console
5+
appender.console.name=STDOUT
6+
appender.console.layout.type=PatternLayout
7+
appender.console.layout.pattern=[%d] %p %m (%c)%n

0 commit comments

Comments
 (0)