SonarQube multi module maven project

I have the following structure for a maven project:
parent
->pom.xml
->project1
->->pom.xml
->project2
->->pom.xml
->project3
->->subprojects
->->->subproject1
->->->->pom.xml
->->->subproject2
->->->->pom.xml

I’m trying to run sonar analysis on all projects in the parent directory (project1, project2, subproject1, subproject2) through the following sonar-project.properties file:

# Root project information
sonar.projectKey=parent
sonar.projectName=parent
sonar.projectVersion=1.0

#List of module identifiers
sonar.modules= project1, project2, project3/subprojects/subproject1, project3/subprojects/subproject2

#event settings
project1.sonar.projectName=p1
project1.sonar.sources=src
project1.sonar.java.binaries=target/classes

#replicate settings
project2.sonar.projectName=p2
project2.sonar.sources=src
project2.sonar.java.binaries=target/classes

#subproject1 settings
project3/subprojects/subproject1.sonar.projectName=sp1
project3/subprojects/subproject1.sonar.modules=src
project3/subprojects/subproject1.sonar.java.binaries= target/classes

#subproject2 settings
project3/subprojects/subproject2.sonar.projectName=sp2
project3/subprojects/subproject2.sonar.modules=src
project3/subprojects/subproject2.sonar.java.binaries= target/classes

However, I am getting the following error in jenkins while trying to run a sonarqube analysis:

"parent:project3/subprojects/subproject1" is not a valid project or module key. Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.

How can I navigate to subproject1 without using ‘/’?

Hi,

Welcome to the community!

If you have pom files in your project that means you’re building with Maven. So you should analyze with Maven too & most of this will just work.

 
Ann

I’m not sure what you mean by building with maven. Would I take out the sonar-properties file from my project and simply run the sonar-scanner command inside the project in order for it to detect the structure of the project?

Hi,

There’s a documentation link in my previous post. It explains how it all works. But yes, drop sonar-project.properties. Then run mvn clean install sonar:sonar.

 
Ann

Thank you! this worked