@@ -88,15 +88,21 @@ tasks {
8888
8989 // 3. the relocated and isolated javaagent libs are merged together with the bootstrap libs (which undergo relocation
9090 // in this task) and the upstream javaagent jar; duplicates are removed
91- shadowJar {
91+ val shadowJarWithDuplicates by registering( ShadowJar :: class ) {
9292 configurations = listOf (bootstrapLibs, upstreamAgent)
9393
94+ // using logback in this distro
95+ // this excludes slf4j-simple from the upstream agent
96+ // but it doesn't exclude logback's files in this package since they haven't been shaded
97+ // into this package yet at the time exclusion takes place
98+ exclude(" io/opentelemetry/javaagent/slf4j/impl/**" )
99+
94100 dependsOn(isolateJavaagentLibs)
95101 from(isolateJavaagentLibs.get().outputs)
96102
97103 duplicatesStrategy = DuplicatesStrategy .EXCLUDE
98104
99- archiveClassifier.set(" " )
105+ archiveClassifier.set(" dontuse " )
100106
101107 manifest {
102108 attributes(jar.get().manifest.attributes)
@@ -109,9 +115,21 @@ tasks {
109115 }
110116 }
111117
118+ // a separate task is needed to get rid of duplicates
119+ shadowJar {
120+ archiveClassifier.set(" " )
121+
122+ dependsOn(shadowJarWithDuplicates)
123+
124+ from(zipTree(shadowJarWithDuplicates.get().archiveFile))
125+
126+ manifest {
127+ attributes(shadowJarWithDuplicates.get().manifest.attributes)
128+ }
129+ }
130+
112131 jar {
113- // Empty jar that cannot be used for anything and isn't published.
114- archiveClassifier.set(" dontuse" )
132+ enabled = false
115133 }
116134
117135 assemble {
0 commit comments