hantsy
(Hantsy Bai)
December 12, 2023, 12:42am
1
Today I tried to integrate a new project into Sonar Cloud to analyze the code quality.
In Sonar Dashboard, I added the project from Github(I have selected my Github repositories in Github app SonarCloud)
In Administration/Anaylsis method, I disable the automatic analysis.
In my project I added sonar maven plugin declaration.
In the Github actions workflow, I used the sonar:sonar to send jacoco report to SonarCloud.
https://github.com/hantsy/jakartaee10-starter-boilerplate/blob/master/.github/workflows/build.yml#L34
After first build, go to my SonarCloud dashboard, the new project title become “demo”, not the original “jakartaee10-starter-boilerplate”, see: https://sonarcloud.io/project/overview?id=hantsy_jakartaee10-starter-boilerplate
Colin
(Colin)
December 13, 2023, 3:04pm
2
Hey there.
It’s taking that from here:
<?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>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<!-- Global Maven settings -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Jakarta EE 10 targets Java 11, but it is also required to support Java 17 -->
<maven.compiler.release>17</maven.compiler.release>
You can pass in a different sonar.projectName
either as an analysis parameter to your mvn
command (mvn sonar:sonar -Dsonar.projectKey=jakartaee10-starter-boilerplate
or in your pom.xml
<properties>
<sonar.projectName>jakartaee10-starter-boilerplate</sonar.projectName>
</properties>
or change the name of your artifact.
hantsy
(Hantsy Bai)
December 14, 2023, 1:19am
3
The project key is not working now???
But I have used it in several projects before , eg
https://github.com/hantsy/cargotracker/blob/master/.github/workflows/build.yml#L79
hantsy
(Hantsy Bai)
December 14, 2023, 2:28am
4
Tried to change as your codes, got the error like this,
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar (default-cli) on project demo: main component does not belong to specified organization -> [Help 1]
Colin
(Colin)
December 14, 2023, 8:47am
5
Which option did you use?