java 使用 mvn sonar 运行声纳分析:sonar 忽略 sonar-project.properties
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45095379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running sonar analysis with mvn sonar:sonar ignores sonar-project.properties
提问by Paul Verest
Latest 3.3 sonar-maven-plugin and 5.6 LTS as web server.
Running sonar analysis with mvn sonar:sonar
( Scanner for Maven)
ignores sonar-project.properties
file. (with many parameters https://docs.sonarqube.org/display/SONAR/Analysis+Parameters)
最新的 3.3 sonar-maven-plugin 和 5.6 LTS 作为 Web 服务器。
使用mvn sonar:sonar
( Scanner for Maven)运行声纳分析会
忽略sonar-project.properties
文件。(有很多参数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
文件中配置所有声纳参数?
回答by janos
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扫描仪时通过分析参数,将它们设置为<properties>
在pom.xml
,例如:
<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
回答by Paul Verest
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>