Skip to content

Commit ece9880

Browse files
committed
Don't use new slf4j features to support Maven (and likely Gradle)
1 parent e9dd6a8 commit ece9880

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<groupId>org.slf4j</groupId>
2121
<artifactId>slf4j-api</artifactId>
2222
<version>${slf4j.version}</version>
23+
<!-- provided by the bootstrapper plugin context (Maven, Gradle) -->
24+
<scope>provided</scope>
2325
</dependency>
2426
<dependency>
2527
<groupId>com.squareup.okhttp3</groupId>

lib/src/main/java/org/sonarsource/scanner/lib/ScannerEngineBootstrapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ public ScannerEngineBootstrapper setBootstrapProperty(String key, String value)
9595
* Bootstrap the scanner-engine.
9696
*/
9797
public ScannerEngineFacade bootstrap() {
98-
LOG.atDebug().addArgument(() -> FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory())).log("Scanner max available memory: {}");
98+
if (LOG.isDebugEnabled()) {
99+
LOG.debug("Scanner max available memory: {}", FileUtils.byteCountToDisplaySize(Runtime.getRuntime().maxMemory()));
100+
}
99101
initBootstrapDefaultValues();
100102
var properties = Map.copyOf(bootstrapProperties);
101103
var isSonarCloud = isSonarCloud(properties);

lib/src/main/java/org/sonarsource/scanner/lib/internal/JavaRunner.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public boolean execute(List<String> args, @Nullable String input, Consumer<Strin
5252
try {
5353
List<String> command = new ArrayList<>(args);
5454
command.add(0, javaExecutable.toString());
55-
LOG.atDebug().addArgument(() -> String.join(" ", command)).log("Executing: {}");
55+
if (LOG.isDebugEnabled()) {
56+
LOG.debug("Executing: {}", String.join(" ", command));
57+
}
5658
Process process = new ProcessBuilder(command).start();
5759
if (input != null) {
5860
try (var stdin = process.getOutputStream(); var osw = new OutputStreamWriter(stdin, StandardCharsets.UTF_8)) {

0 commit comments

Comments
 (0)