diff --git a/its/src/test/java/com/sonar/maven/it/suite/MavenTest.java b/its/src/test/java/com/sonar/maven/it/suite/MavenTest.java index 7095e9b1..bd302661 100644 --- a/its/src/test/java/com/sonar/maven/it/suite/MavenTest.java +++ b/its/src/test/java/com/sonar/maven/it/suite/MavenTest.java @@ -167,8 +167,7 @@ void shouldSupportJeeProjects() { ORCHESTRATOR.executeBuild(build); // src/main/webapp is analyzed by web and xml plugin - // scanning all files, so 2 more files (ejb-module/src/main/resources/META-INF/ejb-jar.xml and web-module/src/main/webapp/index.jsp) - assertThat(getMeasureAsInteger("com.sonarsource.it.samples.jee:parent", "files")).isEqualTo(10); + assertThat(getMeasureAsInteger("com.sonarsource.it.samples.jee:parent", "files")).isEqualTo(9); } /** diff --git a/src/it/java-multi-module/verify.groovy b/src/it/java-multi-module/verify.groovy index f9e5da8f..312a79d4 100644 --- a/src/it/java-multi-module/verify.groovy +++ b/src/it/java-multi-module/verify.groovy @@ -9,4 +9,4 @@ def sources = 'sonar.sources' def module1Sources = "org.codehaus.sonar:sample-project-module1.$sources" assert properties."$module1Sources" == properties."$projectBaseDir" + "/module1/pom.xml" -assert properties."$sources" == properties."$projectBaseDir" + "/pom.xml" + "," + properties."$projectBaseDir" + "/verify.groovy" +assert properties."$sources" == properties."$projectBaseDir" + "/pom.xml" \ No newline at end of file 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 e214ad26..75ccf964 100644 --- a/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java +++ b/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java @@ -140,8 +140,7 @@ Map collectProperties() } private static boolean shouldCollectAllSources(Properties userProperties) { - String sonarScanAll = userProperties.getProperty(MavenScannerProperties.PROJECT_SCAN_ALL_SOURCES, Boolean.TRUE.toString()); - return Boolean.TRUE.equals(Boolean.parseBoolean(sonarScanAll)); + return Boolean.TRUE.equals(Boolean.parseBoolean(userProperties.getProperty(MavenScannerProperties.PROJECT_SCAN_ALL_SOURCES))); } private static String notCollectingAdditionalSourcesBecauseOf(String overriddenProperty) { 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 e62ccabf..568f6391 100644 --- a/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java +++ b/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java @@ -34,10 +34,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.*; import org.junit.jupiter.api.io.TempDir; import org.mockito.*; import org.sonarsource.scanner.api.EmbeddedScanner; @@ -155,17 +152,16 @@ void testNullServerVersion() { } @Test - void scanAll_property_is_applied_by_default() throws MojoExecutionException { + void scanAll_property_is_not_applied_by_default() throws MojoExecutionException { // When sonar.scanner.scanAll is not set verifyCollectedSources(sourceDirs -> { - assertThat(sourceDirs).hasSize(3); + assertThat(sourceDirs).hasSize(2); assertThat(sourceDirs[0]).endsWith(Paths.get("src", "main", "java").toString()); assertThat(sourceDirs[1]).endsWith(Paths.get("pom.xml").toString()); - assertThat(sourceDirs[2]).endsWith(Paths.get("src", "main", "resources", "index.js").toString()); }); - verify(log, times(1)).info("Parameter sonar.maven.scanAll is enabled. The scanner will attempt to collect additional sources."); - verify(scannerBootstrapper, times(1)).collectAllSources(any(), eq(false)); + verify(log, never()).info("Parameter sonar.maven.scanAll is enabled. The scanner will attempt to collect additional sources."); + verify(scannerBootstrapper, never()).collectAllSources(any(), anyBoolean()); } @Test