Sonarqube-scanner cannot scan all maven multi-module code

Hello, I am having problems now. I installed SonarQube7.3 in the company intranet environment, but I can’t upload maven multi-module files (including front-end code separated before and after) when using sonarqube-scanner on local win7. Excuse me. How do I need to solve the problem of uploading together?Snipaste_2018-11-08_14-53-14 Snipaste_2018-11-08_14-53-37

Please add pom.xml files content. I only need nodes parent, artifactId, and modules.

Can you give me some examples? A little confused!

Here is example pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>parent.group</groupId>
		<artifactId>parent-name</artifactId>
		<version>parent.version</version>
	</parent>
	<artifactId>artifact</artifactId>
	<packaging>pom</packaging>

	<modules>
		<module>submodule</module>
	</modules>
</project>

I would like to see pom.xml files from beacon-batch, beacon-core and beacon-parent.

beacon-parent

Can you understand the pictures I have cut? The order of pom.xml is beacon-batch, beacon-core, beaconn-parent. Right, my engineer said that the outermost folder is built by us. So there is no pom.xml at the outermost level.

Yes, I understand the files. If beacon-parent contains

<modules>
    <module>beacon-batch</module>
    <module>beacon-core</module>
</modules>

then you can achieve what you want by simply move the beacon-parent pom.xml file to the main directory (this one which contains sonar-project.properties. After that you are able to remove sonar-project.properties and use mvn sonar:sonar to analyze the project.

Hello, I have set up the method you gave me, but mvn sonar:sonar still reported the error, I will give you the screenshot! Please help me see!mvn_cdm%E9%94%99%E8%AF%AF%E6%88%AA%E5%9B%BE

I see:

Please provide compiled classes of your project with sonar.java.binaries property

Did you execute mvn compile before mvn sonar:sonar?

No, this is the code I pulled directly from gitlab, and then configured according to your method.

You have to build the project before the analysis. Please execute mvn package sonar:sonar and the it should work.

Thanks a lot, it works, but I found that the front-end code was not uploaded (eg .js, .html, .css, .py). Or need to upload via sonar scan? The front end code is beacon-batch

%E4%B8%BA%E4%B8%8A%E4%BC%A0%E5%89%8D%E7%AB%AF

To fix that, you have to add:

<properties>
    <sonar.sources>pom.xml,src/main</sonar.sources>
</properties>

in beacon-batch pom.xml file.

1 Like

As long as I join

<sonar.sources> pom.xml, SRC / main </sonar.sources>

It will report a 500 error.
If I don’t add it, I can upload it successfully.%E5%8A%A0%E5%85%A5pom%E6%8A%A5%E9%94%99

You have to check logs on the SonarQube server. They will show you where is the problem.

Thank you, it is useful for the time being.

Thank you, this three pom.xml lines finished my 2 days long search for solution to my problems.

1 Like