Reputation: 3009
I have java project (non -gradle ) and want to test sonarQube. So, I install sonar-scanner for mac (https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/) How do I use it to scan my Java project?
my project structure is: src->main-java->com->mycompany>packageName1->[java files] src->main-java->com->mycompany>packageName2 ->[java files]
This is what I have tried
sonar-scanner -Dsonar.projectKey=WT-QA-API-IS -Dsonar.java.binaries=. -Dsonar.host.url=https://sonarqube.mycompany.com -Dsonar.login= xxxx -Dexclusions=bin
It does not scan the java files in the sub-folders
Thanks for your help
Upvotes: 0
Views: 8925
Reputation: 3402
For doing sonar analysis of a Java Project, you need to provide the compiled .class files, not the java files in sonar.java.binaries
.
Compiled .class files are generally present in target/ folder.
You can either give the relative path like /target/classes/*
or **/*
Sample example:
sonar-scanner -Dsonar.projectKey=WT-QA-API-IS -Dsonar.java.binaries=**/* -Dsonar.host.url=https://sonarqube.mycompany.com -Dsonar.login= xxxx -Dsonar.exclusions=bin
More details you can find here in JAVA| SonarQube Docs
Upvotes: 1