使用 mvn sonar:sonar 运行声纳分析会忽略 sonar-project.properties

2022-01-17 00:00:00 sonarqube java maven

最新的 3.3 sonar-maven-plugin 和 5.6 LTS 作为网络服务器.
使用 mvn sonar:sonar 运行声纳分析(Maven 扫描仪)
忽略 sonar-project.properties 文件.(有许多参数 https://docs.sonarqube.org/display/SONAR/Analysis+Parameters)

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)

这是预期的行为吗?
那么我必须在 pom.xml 文件中配置所有声纳参数吗?

Is it that the expected behavior?
So do I have to configure all sonar parameters within pom.xml files?

推荐答案

另一种方法是通过 Maven 属性插件

问答

   <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>

相关文章