0

I am using JDK 19 in a modular maven project. My project compiles in the shell, but I get errors in Eclipse.

The package org.slf4j is accessible from more than one module: <unnamed>, org.slf4j

The following compiler args work with maven in the shell.

<compilerArgs>
    <arg>--patch-module</arg>
    <arg>org.slf4j=${settings.localRepository}/org/slf4j/slf4j-api/2.0.6/slf4j-api-2.0.6.jar</arg>
</compilerArgs>

How can I teach Eclipse also to use these args?

13
  • Eclipse uses its own compiler with different arguments. Commented Nov 3, 2023 at 8:09
  • 1
    --patch-module does not make sense here. Learn what the error message The package ... is accessible from more than one module: ... means and then fix it even though javac does not show it. Commented Nov 3, 2023 at 9:33
  • 1
    Is the list of modules literally “, org.slf4j”? Assuming that the empty string refers to the unnamed module, you just have to remove slf4j from the class path. Commented Nov 3, 2023 at 14:19
  • @Holger It's not an empty string. It's <unnamed> not formatted as Code Sample. --patch-module is misused here to "patch" a Maven dependency. Maybe trial and error resulted in this "creative" solution. Commented Nov 3, 2023 at 14:59
  • 1
    @howlger so my assumption was correct, slf4j has been placed on the class path and the module path. Commented Nov 3, 2023 at 15:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.