Skip to content

log4j-core >= 2.22.0: Missing spotbugs-annotations dependency #2144

@chrisribble

Description

@chrisribble

Description

Commit 8996e9f added @SuppressFBWarnings annotations to some constructors, but the corresponding Maven dependency was not re-configured so that it would be available at compile time (at least for Gradle projects).

This results in compile warnings while building code that references these classes (org.apache.logging.log4j.core.LoggerContext in my application).

In all of my projects, I switch warnings to errors and fail the build, so this makes log4j-core >= 2.22.0 unusable without hacking my build configuration.

I suggest adding the appropriate Maven dependencies so that the annotations are added to the compile classpath in Maven/Gradle.

Adding the following dependency in Gradle is sufficient to avoid the compile warnings, but needing to do this in each of my applications/subprojects is sub-optimal.

compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.3'

Configuration

Version: 2.22.0 / 2.22.1

Operating system: Linux

JDK: OpenJDK 64-Bit Server VM Temurin-17.0.8.1+1

Logs

$ ./gradlew clean assemble
Configuration on demand is an incubating feature.

> Task :compileJava FAILED
/home/chris/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.22.1/7183a25510a02ad00cc6a95d3b3d2a7d3c5a8dc4/log4j-core-2.22.1.jar(/org/apache/logging/log4j/core/LoggerContext.class): warning: Cannot find annotation method 'value()' in type 'SuppressFBWarnings': class file for edu.umd.cs.findbugs.annotations.SuppressFBWarnings not found
/home/chris/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.22.1/7183a25510a02ad00cc6a95d3b3d2a7d3c5a8dc4/log4j-core-2.22.1.jar(/org/apache/logging/log4j/core/LoggerContext.class): warning: Cannot find annotation method 'justification()' in type 'SuppressFBWarnings'
error: warnings found and -Werror specified
1 error
2 warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions