SonarQube Scanner Jenkins Plugin Failing

Unsure why the job constantly looks for etc/sudoers.d. I’ve tried force ignoring this, but no matter what, the scanner wants to read this for whatever reason.

16:16:34 INFO: Project configuration:
16:16:34 INFO:   Included sources: src/test/**, src/main/**
16:16:34 INFO:   Excluded sources: /etc/sudoers.d
16:16:37 ERROR: Error during SonarQube Scanner execution
16:16:37 java.lang.IllegalStateException: java.nio.file.AccessDeniedException: /etc/sudoers.d
16:16:37 	at org.sonar.java.classpath.AbstractClasspath.getFilesInDir(AbstractClasspath.java:186)
16:16:37 	at org.sonar.java.classpath.AbstractClasspath.getFilesForPattern(AbstractClasspath.java:172)
16:16:37 	at org.sonar.java.classpath.AbstractClasspath.getFilesFromProperty(AbstractClasspath.java:125)
16:16:37 	at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:58)
16:16:37 	at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:317)
16:16:37 	at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:164)
16:16:37 	at org.sonar.java.JavaSquid.<init>(JavaSquid.java:86)
16:16:37 	at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:100)
16:16:37 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
16:16:37 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
16:16:37 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
16:16:37 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
16:16:37 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
16:16:37 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
16:16:37 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
16:16:37 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
16:16:37 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392)
16:16:37 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388)
16:16:37 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)
16:16:37 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
16:16:37 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
16:16:37 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:149)
16:16:37 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
16:16:37 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
16:16:37 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
16:16:37 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
16:16:37 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
16:16:37 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:16:37 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
16:16:37 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:16:37 	at java.lang.reflect.Method.invoke(Method.java:498)
16:16:37 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
16:16:37 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
16:16:37 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
16:16:37 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
16:16:37 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
16:16:37 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
16:16:37 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
16:16:37 Caused by: java.nio.file.AccessDeniedException: /etc/sudoers.d
16:16:37 	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
16:16:37 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
16:16:37 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
16:16:37 	at sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:427)
16:16:37 	at java.nio.file.Files.newDirectoryStream(Files.java:457)
16:16:37 	at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:300)
16:16:37 	at java.nio.file.FileTreeWalker.next(FileTreeWalker.java:372)
16:16:37 	at java.nio.file.Files.walkFileTree(Files.java:2706)
16:16:37 	at java.nio.file.Files.walkFileTree(Files.java:2742)
16:16:37 	at org.sonar.java.classpath.AbstractClasspath$AbstractFileFinder.find(AbstractClasspath.java:280)
16:16:37 	at org.sonar.java.classpath.AbstractClasspath.getMatchingDirs(AbstractClasspath.java:211)
16:16:37 	at org.sonar.java.classpath.AbstractClasspath.getFilesInDir(AbstractClasspath.java:183)
16:16:37 	... 37 more

Hi Steven, welcome to the SonarSource Community!

This is bizarre. I can’t think of a reason our scanner would try to read files in /etc unless somehow the scan was being invoked from there. Earlier in our scanner output, do you see an indication of what the working directory is? What’s the context of how the scanner is invoked on this system?