Perform sonar analysis using the mvn sonar: sonar ignores the .properties sonar project

The latest 3.3 sonar-maven-plugin and 5.6 LTS as a web server.
Perform sonar analysis using mvn sonar:sonar ( Scanner for Maven )
ignores sonar-project.properties file. (with many options https://docs.sonarqube.org/display/SONAR/Analysis+Parameters )

Is this expected behavior?
So do I need to configure all the sonar parameters in the pom.xml files?

+5
source share
2 answers

This is true: the scanner for Maven ignores the sonar-project.properties file.

To pass analysis parameters when using the scanner for Maven, set them as <properties> in pom.xml , for example:

 <properties> <sonar.host.url>http://yourserver</sonar.host.url> </properties> 

Or you can also pass parameters using -D on the command line, for example:

 mvn sonar:sonar -Dsonar.host.url=http://yourserver 
+7
source

Another way would be to configure reading through http://www.mojohaus.org/properties-maven-plugin/

Q & A

  <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <phase>initialize</phase> <goals> <goal>read-project-properties</goal> </goals> <configuration> <files> <file>sonar-project.properties</file> </files> </configuration> </execution> </executions> </plugin> </plugins> 
+1
source

Source: https://habr.com/ru/post/1269817/


All Articles