detekt / sonar-detekt

SonarQube plugin for Kotlin
https://detekt.dev
GNU Lesser General Public License v3.0
493 stars 52 forks source link

java.lang.IllegalArgumentException: Given path src/main does not exist! #163

Open iamdeepakrane opened 1 year ago

iamdeepakrane commented 1 year ago

ERROR: Error during SonarScanner execution 14:31:50 java.lang.IllegalArgumentException: Given path src/main does not exist! 14:31:50 at io.gitlab.arturbosch.detekt.core.KtTreeCompiler.compile(KtTreeCompiler.kt:22) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.ParsingStrategyKt$inputPathsToKtFiles$1.invoke(ParsingStrategy.kt:25) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.ParsingStrategyKt$inputPathsToKtFiles$1.invoke(ParsingStrategy.kt:23) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$filesToAnalyze$1.invoke(Lifecycle.kt:36)

cortinico commented 1 year ago

Not enough information to debug this. What were you doing? What's your environment?

14:31:50 java.lang.IllegalArgumentException: Given path src/main does not exist!

Is the src/main path existing?

iamdeepakrane commented 1 year ago

My Jenkin build is failing with this exception which was working till yesterday. No changes done in code, suddenly started breaking with this exception while doing sonar scan.

In my build.gradle I have this id("io.gitlab.arturbosch.detekt") version("1.9.1")

full stacktrace: 14:31:45 INFO: Quality profile for java: MyWay-Java 14:31:45 INFO: Quality profile for kotlin: MyWay 14:31:45 INFO: Quality profile for xml: MyWay-XML 14:31:45 INFO: ------------- Run sensors on module plugin-adwords 14:31:46 INFO: Load metrics repository 14:31:46 INFO: Load metrics repository (done) | time=16ms 14:31:46 INFO: Sensor JavaSquidSensor [java] 14:31:46 INFO: Configured Java source version (sonar.java.source): 8 14:31:46 INFO: JavaClasspath initialization 14:31:46 INFO: JavaClasspath initialization (done) | time=11ms 14:31:46 INFO: JavaTestClasspath initialization 14:31:46 INFO: JavaTestClasspath initialization (done) | time=1ms 14:31:46 INFO: Java Main Files AST scan 14:31:46 INFO: 0 source files to be analyzed 14:31:46 INFO: 0/0 source files have been analyzed 14:31:46 INFO: Java Main Files AST scan (done) | time=5ms 14:31:46 INFO: Java Test Files AST scan 14:31:46 INFO: 1 source file to be analyzed 14:31:46 INFO: Load project repositories 14:31:46 INFO: Load project repositories (done) | time=55ms 14:31:47 INFO: 1/1 source file has been analyzed 14:31:47 INFO: Java Test Files AST scan (done) | time=562ms 14:31:47 INFO: Java Generated Files AST scan 14:31:47 INFO: 0 source files to be analyzed 14:31:47 INFO: 0/0 source files have been analyzed 14:31:47 INFO: Java Generated Files AST scan (done) | time=1ms 14:31:47 INFO: Sensor JavaSquidSensor [java] (done) | time=864ms 14:31:47 INFO: Sensor CSS Rules [cssfamily] 14:31:47 INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped. 14:31:47 INFO: Sensor CSS Rules [cssfamily] (done) | time=1ms 14:31:47 INFO: Sensor JaCoCo XML Report Importer [jacoco] 14:31:47 INFO: Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list. 14:31:47 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=378ms 14:31:47 INFO: Sensor Kotlin Sensor [kotlin] 14:31:47 INFO: 45 source files to be analyzed 14:31:49 INFO: 45/45 source files have been analyzed 14:31:49 INFO: Sensor Kotlin Sensor [kotlin] (done) | time=1264ms 14:31:49 INFO: Sensor KotlinSurefireSensor [kotlin] 14:31:49 INFO: parsing [/mnt/ext-storage/jenkins/workspace/feature_CPG-982/plugin-adwords/target/surefire-reports] 14:31:49 INFO: Sensor KotlinSurefireSensor [kotlin] (done) | time=1ms 14:31:49 INFO: Sensor DetektSensor [detekt] 14:31:50 INFO: ------------------------------------------------------------------------ 14:31:50 INFO: EXECUTION FAILURE 14:31:50 INFO: ------------------------------------------------------------------------ 14:31:50 INFO: Total time: 6.849s 14:31:50 INFO: Final Memory: 32M/444M 14:31:50 INFO: ------------------------------------------------------------------------ 14:31:50 ERROR: Error during SonarScanner execution 14:31:50 java.lang.IllegalArgumentException: Given path src/main does not exist! 14:31:50 at io.gitlab.arturbosch.detekt.core.KtTreeCompiler.compile(KtTreeCompiler.kt:22) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.ParsingStrategyKt$inputPathsToKtFiles$1.invoke(ParsingStrategy.kt:25) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.ParsingStrategyKt$inputPathsToKtFiles$1.invoke(ParsingStrategy.kt:23) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$filesToAnalyze$1.invoke(Lifecycle.kt:36) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$filesToAnalyze$1.invoke(Lifecycle.kt:36) 14:31:50 at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:42) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.measure(Lifecycle.kt:32) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.analyze(Lifecycle.kt:36) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.DefaultLifecycle.analyze(Lifecycle.kt:59) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:43) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:42) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:26) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:42) 14:31:50 at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:25) 14:31:50 at io.gitlab.arturbosch.detekt.sonar.sensor.DetektSensor.execute(DetektSensor.kt:23) 14:31:50 at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48) 14:31:50 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85) 14:31:50 at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59) 14:31:50 at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77) 14:31:50 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59) 14:31:50 at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82) 14:31:50 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) 14:31:50 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) 14:31:50 at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392) 14:31:50 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388) 14:31:50 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:385) 14:31:50 at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357) 14:31:50 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) 14:31:50 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) 14:31:50 at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150) 14:31:50 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137) 14:31:50 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123) 14:31:50 at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72) 14:31:50 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66) 14:31:50 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) 14:31:50 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 14:31:50 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 14:31:50 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 14:31:50 at java.lang.reflect.Method.invoke(Method.java:498) 14:31:50 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 14:31:50 at com.sun.proxy.$Proxy0.execute(Unknown Source) 14:31:50 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189) 14:31:50 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138) 14:31:50 at org.sonarsource.scanner.cli.Main.execute(Main.java:112) 14:31:50 at org.sonarsource.scanner.cli.Main.execute(Main.java:75) 14:31:50 at org.sonarsource.scanner.cli.Main.main(Main.java:61)

cortinico commented 1 year ago

id("io.gitlab.arturbosch.detekt") version("1.9.1")

That's an extremely old version of Detekt so it's hard to support you at this stage

iamdeepakrane commented 1 year ago

I changed the version to 1.19.0 Still getting same issue. I have not configured this path src/main anywhere

iamdeepakrane commented 1 year ago

Oh I have given this in sonar configuration withSonarQubeEnv { def submoduleOptions = projectModules.collect {"\ -D${it}.sonar.sources='src/main' \ -D${it}.sonar.tests='src/test' \ -D${it}.sonar.java.binaries='build/classes/' \ -D${it}.sonar.java.libraries='build/dependencies/' " }

Not sure if its referring to this src/main path. It was working earlier

iamdeepakrane commented 1 year ago

Any clue whats going wrong here?

LiohAu commented 1 year ago

I have the same issue after upgrading from sonarqube 8.2 to sonarqube 8.9 and upgrading detekt 2.0.0 to 2.5.0