Sonarqube Version: Data Center Edition - Version 9.6 (build 59041)
Below is issue message on sonarqube, there is not issue in project, everything work fine. Location given here /agent/_work/2/s/ is location on host where this build is running.
This file “MyJavaFile.java” should be located in “com/vipin” directory, not in “/agent/_work/2/s/src/main/java/com/vipin”.
Package declaration should match source file directoryjava:S1598
Any idea what is wrong here? How do I fix this issue.
How are you executing analysis of the code (Using Maven? Gradle? The vanilla SonarScanner?)
Sharing your Azure DevOps Pipeline configuration (which runs the SonarQube analysis) might be helpful.
Running it using maven, here part of Azure pipeline
- stage: Build
displayName: 'Build & Test Stage'
- job: codelintAndCoverage
displayName: 'Sonar and WhiteSource Scanning'
- group: ABC
- task: SonarQubePrepare@4
- task: Maven@3
displayName: 'maven test'
- task: SonarQubePublish@4
That’s really interesting – thanks. I’ll flag this thread for some expert attention.
My code base was messed up, intellij doesn’t show directory renaming nicely in changes. So actually I had to change directory name and commit to fix it. It was showing correct name when I deleted project and did git pull again it showed wrong package name which then I fixed. Overall you can close the issue now. Thanks.