tycho icon indicating copy to clipboard operation
tycho copied to clipboard

SLF4J(W): No SLF4J providers were found using tycho surefire plugin

Open cmoulliard opened this issue 2 months ago • 6 comments

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> 

cmoulliard avatar Nov 17 '25 11:11 cmoulliard

The slf4j jar are well included as Equinox plugins - see screenshot

Image

cmoulliard avatar Nov 17 '25 13:11 cmoulliard

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.

laeubi avatar Nov 17 '25 13:11 laeubi

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>

cmoulliard avatar Nov 17 '25 14:11 cmoulliard

See https://tycho.eclipseprojects.io/doc/latest/target-platform-configuration/target-platform-configuration-mojo.html#dependency-resolution

laeubi avatar Nov 17 '25 14:11 laeubi

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

cmoulliard avatar Nov 17 '25 15:11 cmoulliard

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>
...

mmosconi1 avatar Dec 12 '25 18:12 mmosconi1