Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi module project analysis with SonarQube

SonarQube Server 5.1.2, Sonar-Runner 2.4

As provide in Multi-moduleProject i have created a project structure as

Accounts
|
->invoice
  |
   ->src

->receipt
  |
   ->src

->sonar.properties

File:sonar.properties

sonar.projectKey=org.mycompany.acc
sonar.projectName=Account
sonar.projectVersion=1.0

sonar.sources=src

sonar.modules=invoice,receipt

invoice.sonar.projectName=Invoice
receipt.sonar.projectName=Receipt

When execute with above configuration in sonar-runner i encountered with error "src" folder is missing in "Account" directory, hope this configuration is same as the conf available in that link. As per the understanding if the configuration is fine then the Invoice and Receipt will be listed as sub project under Account Project, so what are the changes are required in above configuration to achieve multi module / project under one project.

ERROR

ERROR: Error during Sonar runner execution ERROR: Unable to execute Sonar ERROR: Caused by: The folder 'src' does not exist for 'org.mycompany.acc' (base directory = C:\Users\xyz\Accounts\.) ERROR: ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with t he -e switch. ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

like image 347
Jeevanantham Avatar asked Aug 26 '15 13:08

Jeevanantham


People also ask

How to analyze a multi-module Maven project using SonarQube?

Download the SonarQube Scanner (CLI), which provides a CLI to analyze projects of any language. Unpack the SonarQube Scanner and navigate into the conf directory. Open up the sonar-scanner.properties. You are ready to analyze your Multi-Module Maven Project! Imagine we have a Multi-Module Maven Project with the following structure

How do I configure SonarQube for my project?

There are multiple ways of configuring SonarQube for your project. You may define the project settings on the parent-level, or overwrite properties in each module. For the sake of simplicity, let us just define the settings in the parent module. Create a sonar-project.properties file in the parent folder.

How does SonarQube work?

Let’s see how SonarQube works by running a project test using the example provided. To do so: Run the sonar-scanner command to start the analysis. Once it finishes, you will see in the log’s information that the analysis was successfully executed.

How do I run an automatic analysis in SonarQube?

Navigate to the SonarQube UI, you will see that it is running an automatic analysis. As seen in the screenshot above, there is a bug, a vulnerability, and some code smells in the project. Let’s focus on the vulnerability to see how GitHub, Travis, and SonarQube synchronize their jobs.


1 Answers

try this:

sonar.projectKey=org.mycompany.acc
sonar.projectName=Account
sonar.projectVersion=1.0

sonar.sources=src # try to remove this by the way if you don't have suchdirectory under root folder of project

sonar.modules=invoice,receipt

invoice.sonar.projectName=Invoice
invoice.sonar.sources=invoice/src
receipt.sonar.projectName=Receipt
receipt.sonar.sources=receipt/src
like image 135
Мокич Андрей Avatar answered Sep 22 '22 14:09

Мокич Андрей