Running sonar analysis with mvn sonar:sonar ignores sonar-project.properties

前端 未结 2 2070
慢半拍i
慢半拍i 2021-02-05 12:09

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

相关标签:
2条回答
  • 2021-02-05 12:44

    Other way would be to configure reading via Maven Properties Plugin

    Q&A

       <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>
    
    0 讨论(0)
  • 2021-02-05 13:04

    That is correct: 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 the pom.xml, for example:

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

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

    mvn sonar:sonar -Dsonar.host.url=http://yourserver
    
    0 讨论(0)
提交回复
热议问题