Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle sonar plugin looking in the wrong directory #421

Open
adamkorynta opened this issue Apr 26, 2024 · 4 comments
Open

Gradle sonar plugin looking in the wrong directory #421

adamkorynta opened this issue Apr 26, 2024 · 4 comments

Comments

@adamkorynta
Copy link

When I run the gradle sonar plugin, the GradleDependencyScanner is using the context path to look for the license-details.json file:

This ends up looking in a directory under my gradle project's build/sonar/<gradle-project-name>/build/reports/dependency-license/license-details.json. I tried to configure my JK1 plugin to output to that directory, but it looks like the gradle sonar task cleans the directory prior to running the analylsis.

2024-04-25T17:15:42.300-0700 [DEBUG] [org.sonarqube.gradle.SonarTask] Searching for license file at build\reports\dependency-license\license-details.json
2024-04-25T17:15:42.300-0700 [INFO] [org.sonarqube.gradle.SonarTask] No license-details.json file found in C:\Git\myrepo\build\sonar\myrepo-parent-plugin\build\reports\dependency-license\license-details.json - skipping Gradle dependency scan

I'll note that I have many gradle subprojects and I am running the sonar task on the root project with the same configuration identified in the REAMD.md.

@derhecht
Copy link
Contributor

derhecht commented May 15, 2024

same problem here

additionally could not override it with config GRADLE_JSON_REPORT_PATH

it also looks like there is typo/camelcase problem: licenseCheck.gradle-json-report-path vs licensecheck.gradle-json-report-path

using standalone sonarqube runner in docker container but sonar is always try to find a file in: .scannerwork/build/reports/dependency-license/license-details.json

SOLVED by: adding ../ in front of my licenseCheck.gradle-json-report-path path definition. i think this is because File licenseDetailsJsonFile = context
.fileSystem()
.baseDir()
.toPath()
.resolve(pathDef)... - contains baseDir which is in my setup the .scannerwork folder of sonarqube container

@agi1clj
Copy link

agi1clj commented Jul 2, 2024

Same problem here.
@derhecht did you change directly in the code?

@derhecht
Copy link
Contributor

derhecht commented Jul 2, 2024

Same problem here. @derhecht did you change directly in the code?

there are two optons:

  1. in Sonarqube GUI URL/admin/settings?category=license+check at the bottom
  2. we've a global setup where I just add "-DlicenseCheck.gradle-json-report-path=../build/reports/dependency-license/license-details.json" when calling sonarqube runner Docker

@agi1clj
Copy link

agi1clj commented Jul 2, 2024

That's great. Thanks a lot @derhecht .
In my case worked with: ../reports/dependency-license/license-details.json
I did it from the Sonarqube GUI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants