Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
surefire issue with modules
foo-slf4-impl: with a particular class foo.bar.logging.FooBarHelper
module-info.java
module foo.bar.logging
{
requires transitive org.slf4j;
exports foo.bar.logging;
provides org.slf4j.spi.SLF4JServiceProvider with
foo.bar.logging.Slf4jLoggingServiceProvider;
}
foo-util: foo-slf4-impl as scope test
some class in src/test/java use foo.bar.logging.FooBarHelper
module-info.java
module foo.bar.util {
requires org.slf4j;
}
slf4j-api 2.0.0-alpha6 has module-info
module org.slf4j {
uses org.slf4j.spi.SLF4JServiceProvider;
}
but error
(in module foo.bar.util) cannot access class foo.bar.logging.FooBarHelper (in module foo.bar.logging)
because module foo.bar.util does not read module foo.bar.logging
module foo.bar.logging is added to module-path because it provides org.slf4j.spi.SLF4JServiceProvider whereas it is a test scope dependency.
easy solution is to add `--add-reads foo.bar.util=foo.bar.logging`
but this doesn't look right. Shouldn't we have all test scope/provided dependencies only in classpath (and not module-path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment