How to configure Maven to run a SonarQube project analysis with two different quality profiles?

后端 未结 4 1319
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 03:19

We run SonarQube analyses for our Java projects via Maven. Maven somehow does this automagically; all we did was add the sonar-maven-plugin to our pom.xml

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 03:58

    Expanding on the previous answer given by Eldad AK regarding profiles:

    Create two maven profiles as follows:

    
      Dev_${sonar.profile}
    
    
    
      
        QualityProfileOne
        
          MyQualityProfile1
        
      
      
        QualityProfileTwo
        
          MyQualityProfile2
        
      
    
    

    Then run the following:

    $ mvn clean install -DskipTests
    $ mvn sonar:sonar -PQualityProfileOne
    $ mvn sonar:sonar -PQualityProfileTwo
    

    (you may need to perform a clean between running sonar, not sure)

提交回复
热议问题