Repository: jhipster/jhipster-lite (java)

Issue:
Docs: sonar commands in readme
The sonar commands in readme should be in a dedicated section instead of startup
See https://github.com/jhipster/jhipster-lite-sample-app

![image](https://github.com/user-attachments/assets/54f0a18a-238c-4512-a9d0-41f6501f8e84)



Pull request description:
Docs: sonar commands in sonar.md
Fix #10552 

Related to #10561 

Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactory.java
index 5e6f6660f..32d3ac66a 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactory.java
@@ -50,11 +50,6 @@ public class SonarQubeModulesFactory {
         .put("sonarqubeDockerImage", dockerImages.get(SONARQUBE).fullName())
         .and()
       .documentation(documentationTitle("sonar"), SOURCE.template("sonar.md"))
-      .startupCommands()
-        .dockerCompose("src/main/docker/sonar.yml")
-        .maven("clean verify sonar:sonar")
-        .gradle("clean build sonar --info")
-        .and()
       .mavenPlugins()
         .pluginManagement(propertiesPlugin())
         .plugin(propertiesPluginBuilder().build())
diff --git a/src/main/resources/generator/server/sonar/sonar.md.mustache b/src/main/resources/generator/server/sonar/sonar.md.mustache
index 67ff20105..8097fd6c0 100644
--- a/src/main/resources/generator/server/sonar/sonar.md.mustache
+++ b/src/main/resources/generator/server/sonar/sonar.md.mustache
@@ -1,7 +1,24 @@
 # Usage
 
-Follow the [startup instructions in the README](../README.md#start-up)
+Start a local Sonar server with:
+```bash
+docker compose -f src/main/docker/sonar.yml up -d
+```
+
+Then, run a Sonar analysis:
+
+For Maven
+```bash
+./mvnw clean verify sonar:sonar
+```
+
+or
+
+For Gradle
+```bash
+./gradlew clean build sonar --info"
+```
 
 You can see the result at [http://localhost:9001/](http://localhost:9001/)
 
-[official documentation](https://www.sonarqube.org/)
+[Official documentation](https://www.sonarqube.org/)


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java
index 38f0a2451..409bcbba3 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/sonarqube/domain/SonarQubeModulesFactoryTest.java
@@ -111,11 +111,14 @@ class SonarQubeModulesFactoryTest {
         .containing("sonarqube:1.1.1")
         .and()
         .hasFile("documentation/sonar.md")
-        .containing("Follow the [startup instructions in the README](../README.md#start-up)")
+        .containing("docker compose -f src/main/docker/sonar.yml up -d")
+        .containing("./gradlew clean build sonar --info")
         .and()
-        .hasFile("README.md")
+        .hasFile("documentation/sonar.md")
         .containing("docker compose -f src/main/docker/sonar.yml up -d")
         .containing("./mvnw clean verify sonar:sonar")
+        .and()
+        .hasFile("README.md")
         .and();
     }
   }
@@ -198,9 +201,11 @@ class SonarQubeModulesFactoryTest {
           """
         )
         .and()
-        .hasFile("README.md")
+        .hasFile("documentation/sonar.md")
         .containing("docker compose -f src/main/docker/sonar.yml up -d")
         .containing("./gradlew clean build sonar --info")
+        .and()
+        .hasFile("README.md")
         .and();
     }
   }