Skip to content

Commit

Permalink
chore(dependencies): remove unnecessary dependency on log4j-core
Browse files Browse the repository at this point in the history
and make dependencies on log4j-api explicit.

#1069 introduced the dependency on org.apache.logging.log4j.log4j-core in kork-artifacts, but it's not necessary.  At least, after removing it, and verifying the dependency is gone from

$ ./gradle kork-artifacts:dependencies

the code still builds fine.  As well

$ git grep "import org.apache.logging.log4j"
kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/user/UserSecretTypeProvider.java:import org.apache.logging.log4j.LogManager;
kork-security/src/main/java/com/netflix/spinnaker/security/AuthenticatedRequestDecorator.java:import org.apache.logging.log4j.ThreadContext;

turns up classes present in log4j-api, but nothing in log4j-core.

As well uses of the @log4j2 annotation depend on log4j-api (see https://projectlombok.org/api/lombok/extern/log4j/Log4j2)

$ git grep @log4j2
kork-artifacts/src/main/java/com/netflix/spinnaker/kork/artifacts/artifactstore/ArtifactStoreConfiguration.java:@log4j2
kork-artifacts/src/main/java/com/netflix/spinnaker/kork/artifacts/artifactstore/s3/S3ArtifactStore.java:@log4j2
kork-core/src/main/java/com/netflix/spinnaker/kork/jackson/JsonTypeNameParser.java:@log4j2
kork-credentials/src/main/java/com/netflix/spinnaker/credentials/jackson/SensitiveSerializer.java:@log4j2
kork-secrets/src/main/java/com/netflix/spinnaker/kork/secrets/EncryptedSecret.java:@log4j2

This all makes the comment in spinnaker-dependencies.gradle true again:

Per analysis, log4j-core is not included in dependencies
  • Loading branch information
dbyron-sf committed Aug 10, 2023
1 parent ed082ad commit 7e9d9b4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion kork-artifacts/kork-artifacts.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies {
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.security:spring-security-core"
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.apache.logging.log4j:log4j-core'
api "com.hubspot.jinjava:jinjava"

testImplementation "org.assertj:assertj-core"
Expand Down
1 change: 1 addition & 0 deletions kork-core/kork-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
api "io.github.resilience4j:resilience4j-retry"
api "io.github.resilience4j:resilience4j-spring-boot2"

implementation "org.apache.logging.log4j:log4j-api"
implementation "com.fasterxml.jackson.core:jackson-annotations"
implementation "com.fasterxml.jackson.core:jackson-databind"
implementation "com.netflix.spectator:spectator-ext-gc"
Expand Down
1 change: 1 addition & 0 deletions kork-credentials/kork-credentials.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
api project(":kork-credentials-api")
api project(":kork-annotations")
implementation(platform(project(":spinnaker-dependencies")))
implementation 'org.apache.logging.log4j:log4j-api'
implementation "org.springframework.boot:spring-boot"
implementation 'org.springframework.boot:spring-boot-starter-json'
implementation 'javax.annotation:javax.annotation-api'
Expand Down
1 change: 1 addition & 0 deletions kork-secrets/kork-secrets.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies {
implementation "org.yaml:snakeyaml"
implementation "com.google.guava:guava"
implementation "org.apache.commons:commons-lang3"
implementation "org.apache.logging.log4j:log4j-api"

testImplementation "com.hubspot.jinjava:jinjava"
testImplementation "org.spockframework:spock-core"
Expand Down
1 change: 1 addition & 0 deletions kork-security/kork-security.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {
api "com.fasterxml.jackson.core:jackson-annotations"

implementation "com.google.guava:guava"
implementation "org.apache.logging.log4j:log4j-api"
implementation "org.slf4j:slf4j-api"

testImplementation "org.spockframework:spock-core"
Expand Down

0 comments on commit 7e9d9b4

Please sign in to comment.