Skip to content

Commit a36451e

Browse files
authored
Fixed provided but shaded dependencies in modules by configuring a global shading rule (#693)
1 parent 469136e commit a36451e

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
44
## UNRELEASED
55
### Fixed
66
- Fix for setting `ryuk.container.timeout` causes a `ClassCastException` ([\#684](https://github.com/testcontainers/testcontainers-java/issues/684))
7+
- Fixed provided but shaded dependencies in modules ([\#693](https://github.com/testcontainers/testcontainers-java/issues/693))
78

89
### Changed
910

build.gradle

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ subprojects {
1010
apply plugin: 'java'
1111
apply plugin: 'idea'
1212
apply plugin: 'io.franzbecker.gradle-lombok'
13+
apply plugin: 'com.github.johnrengelman.shadow'
1314
apply from: "$rootDir/gradle/publishing.gradle"
1415
apply from: "$rootDir/gradle/bintray.gradle"
1516

@@ -49,6 +50,42 @@ subprojects {
4950
jcenter()
5051
}
5152

53+
shadowJar {
54+
configurations = []
55+
classifier = null
56+
57+
relocate('META-INF/native/libnetty', 'META-INF/native/liborg-testcontainers-shaded-netty')
58+
59+
[
60+
"org.apache.http",
61+
"org.apache.commons.lang",
62+
"org.apache.commons.io",
63+
"org.apache.commons.codec",
64+
"org.glassfish",
65+
"org.aopalliance",
66+
"org.jvnet",
67+
"javax.annotation",
68+
"javax.inject",
69+
"javax.ws.rs",
70+
"com.fasterxml.jackson",
71+
"jersey.repackaged",
72+
"com.google",
73+
"io.netty",
74+
"org.bouncycastle",
75+
"org.newsclub",
76+
"org.zeroturnaround"
77+
].each { relocate(it, "org.testcontainers.shaded.$it") }
78+
}
79+
80+
publishing {
81+
publications {
82+
mavenJava(MavenPublication) { publication ->
83+
artifacts.removeAll { it.classifier == null }
84+
artifact project.tasks.shadowJar
85+
}
86+
}
87+
}
88+
5289
dependencies {
5390
testCompile 'ch.qos.logback:logback-classic:1.2.3'
5491
}

core/build.gradle

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ apply plugin: 'com.github.johnrengelman.shadow'
22

33
description = "Testcontainers Core"
44

5-
publishing {
6-
publications {
7-
mavenJava(MavenPublication) { publication ->
8-
artifacts.removeAll { it.classifier == null }
9-
artifact project.tasks.shadowJar
10-
}
11-
}
12-
}
13-
145
sourceSets {
156
jarFileTest
167
}
@@ -24,7 +15,6 @@ configurations {
2415

2516
shadowJar {
2617
configurations = [project.configurations.shaded]
27-
classifier = null
2818

2919
mergeServiceFiles()
3020

@@ -46,28 +36,6 @@ shadowJar {
4636
'mozilla/public-suffix-list.txt',
4737
].each { exclude(it) }
4838

49-
relocate('META-INF/native/libnetty', 'META-INF/native/liborg-testcontainers-shaded-netty')
50-
51-
[
52-
"org.apache.http",
53-
"org.apache.commons.lang",
54-
"org.apache.commons.io",
55-
"org.apache.commons.codec",
56-
"org.glassfish",
57-
"org.aopalliance",
58-
"org.jvnet",
59-
"javax.annotation",
60-
"javax.inject",
61-
"javax.ws.rs",
62-
"com.fasterxml.jackson",
63-
"jersey.repackaged",
64-
"com.google",
65-
"io.netty",
66-
"org.bouncycastle",
67-
"org.newsclub",
68-
"org.zeroturnaround"
69-
].each { relocate(it, "org.testcontainers.shaded.$it") }
70-
7139
dependencies {
7240
include(dependency('org.apache.httpcomponents:.*'))
7341
include(dependency('org.glassfish.*:.*'))

0 commit comments

Comments
 (0)