[英]Running sonar analysis with mvn sonar:sonar ignores sonar-project.properties
Latest 3.3 sonar-maven-plugin and 5.6 LTS as web server. 最新3.3声纳-maven-plugin和5.6 LTS作为网络服务器。
Running sonar analysis with mvn sonar:sonar
( Scanner for Maven ) 使用
mvn sonar:sonar
声纳分析mvn sonar:sonar
( 扫描仪为Maven )
ignores sonar-project.properties
file. 忽略
sonar-project.properties
文件。 (with many parameters https://docs.sonarqube.org/display/SONAR/Analysis+Parameters ) (有许多参数https://docs.sonarqube.org/display/SONAR/Analysis+Parameters )
Is it that the expected behavior? 这是预期的行为吗?
So do I have to configure all sonar parameters within pom.xml
files? 那么我是否必须在
pom.xml
文件中配置所有声纳参数?
That is correct: the scanner for Maven ignores the sonar-project.properties
file. 这是正确的:Maven的扫描程序忽略了
sonar-project.properties
文件。
To pass analysis parameters when using the scanner for Maven, set them as <properties>
in the pom.xml
, for example: 要在使用Maven扫描程序时传递分析参数,请在
pom.xml
中将它们设置为<properties>
,例如:
<properties>
<sonar.host.url>http://yourserver</sonar.host.url>
</properties>
Or, you could also pass parameters using -D
on the command line, for example: 或者,您也可以在命令行上使用
-D
传递参数,例如:
mvn sonar:sonar -Dsonar.host.url=http://yourserver
Other way would be to configure reading via Maven Properties Plugin 其他方法是通过Maven Properties Plugin配置读取
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.