Skip to content

Commit e96e011

Browse files
committed
Fix up some module dependencies
1 parent 0e1c0e9 commit e96e011

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

x-pack/plugin/core/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ dependencies {
5353
api "org.apache.httpcomponents.client5:httpclient5:${versions.httpclient5}"
5454
api "org.apache.httpcomponents.core5:httpcore5:${versions.httpcore5}"
5555
api "org.apache.httpcomponents.core5:httpcore5-h2:${versions.httpcore5}"
56-
runtimeOnly "org.slf4j:slf4j-api:${versions.slf4j}"
56+
57+
// Ideally this would be `runtimeOnly` so that we don't accidentally write code against the SLF4j API
58+
// However, some child plugins (like security) need to use slf4j directly in order to manage logging for their dependencies :(
59+
// And due to the way our plugin loading handles java modules between dependent plugins, this plugin (x-pack-core) needs to declare
60+
// a module dependency on slf4j (`requires org.slf4j`) so that security can also be dependent on it
61+
// And having a module dependency counts as using the jar, so we can't make it `runtimeOnly` :(
62+
63+
implementation "org.slf4j:slf4j-api:${versions.slf4j}"
5764
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}"
5865

5966
api "commons-logging:commons-logging:${versions.commonslogging}"
@@ -71,9 +78,6 @@ dependencies {
7178
implementation project(":x-pack:plugin:core:template-resources")
7279

7380
testImplementation "org.elasticsearch:mocksocket:${versions.mocksocket}"
74-
testImplementation "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}"
75-
// this might suffer from https://github.com/elastic/elasticsearch/issues/93714
76-
testImplementation "org.slf4j:slf4j-api:${versions.slf4j}"
7781
testImplementation project(path: ':modules:reindex')
7882
testImplementation project(path: ':modules:parent-join')
7983
testImplementation project(path: ':modules:lang-mustache')

x-pack/plugin/core/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
requires org.elasticsearch.xcore.templates;
2626
requires org.apache.httpcomponents.client5.httpclient5;
2727
requires org.apache.httpcomponents.core5.httpcore5;
28+
requires org.slf4j;
2829

2930
exports org.elasticsearch.index.engine.frozen;
3031
exports org.elasticsearch.license;

x-pack/plugin/identity-provider/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ dependencies {
4545
exclude group: 'org.bouncycastle'
4646
}
4747

48-
api "org.slf4j:slf4j-api:${versions.slf4j}"
49-
runtimeOnly "org.slf4j:slf4j-nop:${versions.slf4j}"
50-
// runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}") https://github.com/elastic/elasticsearch/issues/93714
48+
implementation "org.slf4j:slf4j-api:${versions.slf4j}"
49+
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}")
5150
api "org.apache.httpcomponents:httpclient:${versions.httpclient}"
5251
api "org.apache.httpcomponents:httpcore:${versions.httpcore}"
5352
api "org.apache.httpcomponents:httpasyncclient:${versions.httpasyncclient}"

x-pack/plugin/security/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ dependencies {
6464
api ( "org.cryptacular:cryptacular:1.2.5") {
6565
exclude group: 'org.bouncycastle'
6666
}
67-
api "org.slf4j:slf4j-api:${versions.slf4j}"
68-
runtimeOnly "org.slf4j:slf4j-nop:${versions.slf4j}" // workaround for https://github.com/elastic/elasticsearch/issues/93714
69-
// api "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}" see above
67+
68+
implementation "org.slf4j:slf4j-api:${versions.slf4j}"
69+
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:${versions.log4j}"
7070

7171
api "org.apache.httpcomponents:httpclient:${versions.httpclient}"
7272
api "org.apache.httpcomponents:httpcore:${versions.httpcore}"

0 commit comments

Comments
 (0)