compiler-errorslog4j2java-17java-module

Whats the reason for: module not found: org.jspecify


After doing some dependency updates on my project (Java 17 with modules) I got the following error message during compilation:

[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ energy-meters ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 10 source files with javac [forked debug deprecation release 17  module-path] to target\test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error: module not found: org.jspecify

Because I am not using jspecify, my question is, why did this happens?


Solution

  • In my case the reason was the update to log4j2 2.24.0.

    As it looks there is a problem with this release - see Compiling with 2.24.0 fails: module not found: org.jspecify For me the simplest solution was to go back to version 2.23.1 and wait until log4j2 will release a bug fix version.

    The alternative would be to add jspecify to your dependencies.