[ https://issues.apache.org/jira/browse/SLING-4321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Karl Pauls closed SLING-4321. ----------------------------- > Sling JUnit Remote should depend on SLF4J with Compile Scope > ------------------------------------------------------------ > > Key: SLING-4321 > URL: https://issues.apache.org/jira/browse/SLING-4321 > Project: Sling > Issue Type: Improvement > Components: Testing > Affects Versions: JUnit Remote Tests Runners 1.0.10 > Reporter: Konrad Windszus > Fix For: JUnit Remote Test Runners 1.0.12 > > > Currently Sling JUnit Remote (org.apache.sling.junit.remote, 1.0.10) depends > on SLF4J with scope {{provided}}. Therefore it is not available for a Maven > Module (e.g. a JAR which executes the test on the remote instance), if that > one only depends on org.apache.sling.junit.remote. > That JAR needs to add the dependency to SLF4J explicitly (even if the classes > within the JAR directly do not need that), just because the Sling Remove Test > Runner needs that on the classpath. > Since that dependency may be used at runtime outside of an OSGI container > (why is that a bundle anyways?), e.g. by the maven-failsafe-plugin it should > declare all runtime dependencies with scope {{compile}} or {{runtime}}. > Currently if the maven-failsafe-plugin is executing a test annotated with > SlingTestRunner and the dependency to SLF4J is not added it fails with the > following error: > {code} > java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory > at > org.apache.sling.junit.remote.testrunner.SlingRemoteTestRunner.<clinit>(SlingRemoteTestRunner.java:46) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:408) > at > org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) > at > org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) > at > org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) > at > org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) > at > org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) > at > org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) > at > org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262) > at > org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) > at > org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) > at > org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) > at > org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) > at > org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) > Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory > at java.net.URLClassLoader$1.run(URLClassLoader.java:372) > at java.net.URLClassLoader$1.run(URLClassLoader.java:361) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:360) > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > at > org.apache.sling.junit.remote.testrunner.SlingRemoteTestRunner.<clinit>(SlingRemoteTestRunner.java:46) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:408) > at > org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) > at > org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) > at > org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) > at > org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) > at > org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) > at > org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) > at > org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:262) > at > org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) > at > org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) > at > org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) > at > org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) > at > org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) > Results : > Tests in error: > RemoteIT.initializationError ยป NoClassDefFound org/slf4j/LoggerFactory > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)