From 2791f1b2dd1d264a8e47866072279bd09882694a Mon Sep 17 00:00:00 2001 From: Angelo Date: Fri, 8 Sep 2023 11:23:04 +0200 Subject: [PATCH] MSONAR-188 Remove explicit classloader masks and rely on the default EmbeddedScanner masks (#179) --- pom.xml | 2 +- .../maven/bootstrap/ScannerBootstrapper.java | 21 ------------------- .../bootstrap/ScannerBootstrapperTest.java | 3 --- 3 files changed, 1 insertion(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 2b217039..9dfb13a2 100644 --- a/pom.xml +++ b/pom.xml @@ -138,7 +138,7 @@ org.sonarsource.scanner.api sonar-scanner-api - 2.16.2.588 + 2.16.3.1081 diff --git a/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java b/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java index cbc54024..9d8fd1ce 100644 --- a/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java +++ b/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java @@ -52,7 +52,6 @@ public ScannerBootstrapper(Log log, MavenSession session, EmbeddedScanner scanne public void execute() throws MojoExecutionException { try { - applyMasks(); scanner.start(); serverVersion = scanner.serverVersion(); @@ -68,26 +67,6 @@ public void execute() throws MojoExecutionException { } } - private void applyMasks() { - // Exclude log implementation to not conflict with Maven 3.1 logging impl - scanner.mask("org.slf4j.LoggerFactory"); - // Include slf4j Logger that is exposed by some Sonar components - scanner.unmask("org.slf4j.Logger"); - scanner.unmask("org.slf4j.ILoggerFactory"); - // MSONAR-122 - scanner.unmask("org.slf4j.Marker"); - // Exclude other slf4j classes - // .unmask("org.slf4j.impl.") - scanner.mask("org.slf4j."); - // Exclude logback - scanner.mask("ch.qos.logback."); - scanner.mask("org.sonar."); - // Guava is not the same version in SonarQube classloader - scanner.mask("com.google.common"); - // Include everything else (we need to unmask all extensions that might be passed to the batch) - scanner.unmask(""); - } - private Map collectProperties() throws MojoExecutionException { List sortedProjects = session.getProjects(); diff --git a/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java b/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java index c7682c72..5949fdd5 100644 --- a/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java +++ b/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java @@ -130,9 +130,6 @@ public void testNullServerVersion() { } private void verifyCommonCalls() { - verify(scanner, atLeastOnce()).mask(anyString()); - verify(scanner, atLeastOnce()).unmask(anyString()); - verify(scanner).start(); verify(scanner).serverVersion(); verify(scanner).execute(projectProperties);