SLF4J(W): No SLF4J providers were found using tycho surefire plugin
Issue
When we use the tycho surefire plugin, then it raises the following warning messages as slf4j is not configured properly.
[INFO] --- tycho-surefire:4.0.3:test (default-test) @ java-analyzer-bundle.test ---
[WARNING] Using JavaSE-21 to fulfill requested profile of JavaSE-17 this might lead to faulty dependency resolution, consider define a suitable JDK in the toolchains.xml
[INFO] Executing test runtime with timeout (seconds): 60, logs, if any, will be placed at: /Users/cmoullia/code/application-modernisation/02_konveyor/fork-java-analyzer-bundle/java-analyzer-bundle.test/target/work/data/.metadata/.log
[INFO] Command line:
[/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/bin/java, -Dosgi.noShutdown=false, -Dosgi.os=macosx, -Dosgi.ws=cocoa, -Dosgi.arch=aarch64, -Xmx512m, -XstartOnFirstThread, -Dorg.slf4j.simpleLogger.defaultLogLevel=debug, -Dorg.slf4j.simpleLogger.showDateTime=true, -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS, -Dorg.slf4j.simpleLogger.logFile=System.out, -Dosgi.clean=true, -jar, /Users/cmoullia/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.6.600.v20231106-1826/org.eclipse.equinox.launcher-1.6.600.v20231106-1826.jar, -data, /Users/cmoullia/code/application-modernisation/02_konveyor/fork-java-analyzer-bundle/java-analyzer-bundle.test/target/work/data, -install, /Users/cmoullia/code/application-modernisation/02_konveyor/fork-java-analyzer-bundle/java-analyzer-bundle.test/target/work, -configuration, /Users/cmoullia/code/application-modernisation/02_konveyor/fork-java-analyzer-bundle/java-analyzer-bundle.test/target/work/configuration, -application, org.eclipse.tycho.surefire.osgibooter.uitest, -testproperties, /Users/cmoullia/code/application-modernisation/02_konveyor/fork-java-analyzer-bundle/java-analyzer-bundle.test/target/surefire.properties, -timeout, 60000]
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
Question: How can we configure slf4j and set the jar file to be used please ?
Here are some configurations that I tested without success
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<argLine>${tycho.test.jvmArgs}</argLine>
<appArgLine>
-Dorg.slf4j.simpleLogger.defaultLogLevel=debug
-Dorg.slf4j.simpleLogger.showDateTime=true
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS
-Dorg.slf4j.simpleLogger.logFile=System.out
</appArgLine>
<frameworkExtensions>
<frameworkExtension>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.17</version>
</frameworkExtension>
</frameworkExtensions>
...
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<argLine>${tycho.test.jvmArgs}</argLine>
<appArgLine>
-Dorg.slf4j.simpleLogger.defaultLogLevel=debug
-Dorg.slf4j.simpleLogger.showDateTime=true
-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS
-Dorg.slf4j.simpleLogger.logFile=System.out
</appArgLine>
<frameworkExtensions>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.17</version>
</frameworkExtensions>
The slf4j jar are well included as Equinox plugins - see screenshot
I'm not sure framework extension is really what you want. You would more like to use extra requirements and make sure if you use slf4j2 that also a suitable spi extender (e.g spifly) is included.
You would more like to use extra requirements
I understand what you mean using the extraRequirments tag but what about to configure properly ??? ?
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
???
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
See https://tycho.eclipseprojects.io/doc/latest/target-platform-configuration/target-platform-configuration-mojo.html#dependency-resolution
See https://tycho.eclipseprojects.io/doc/latest/target-platform-configuration/target-platform-configuration-mojo.html#dependency-resolution
Thanks. That should be great if someone creates the needed slf4j requirement and document it as until I still don't what we should provide within the section
I didn't test this exact scenario, but it should work like this:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${version.tycho}</version>
<configuration>
...
<dependency-resolution>
<optionalDependencies>require</optionalDependencies>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>slf4j.api</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>slf4j.simple</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
...