1、首先在jenkins所在机器的的maven配置文件(settings.xml)里做如下配置:

 1 <profile>
 2         <id>sonar</id>
 3         <activation>
 4                 <activeByDefault>true</activeByDefault>
 5         </activation>
 6         <properties>
 7         <!-- EXAMPLE FOR MYSQL -->
 8                 <sonar.jdbc.url>jdbc:mysql://x.x.x.x:3306/sonarsec?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true&amp;useConfigs=maxPerformance</sonar.jdbc.url>
 9                 <sonar.jdbc.driverClassName>com.mysql.jdbc.Driver</sonar.jdbc.driverClassName>
10                 <sonar.jdbc.username>user</sonar.jdbc.username>
11                 <sonar.jdbc.password>password</sonar.jdbc.password>
12                 <sonar.host.url>http://x.x.x.x:9000</sonar.host.url>
13        </properties>
14     </profile>

2、在jenkins的项目配置里

mvn sonar:sonar -Dsonar.branch=master-test -Dsonar.host.url=http://x.x.x.x:9000 -Dsonar.projectKey=test -Dsonar.projectName=test -Dsonar.projectVerision=1.0

如何在jenkins上通过mvn方式运行sonar

 

相关文章:

  • 2021-05-14
  • 2022-12-23
  • 2021-12-03
  • 2021-06-10
  • 2021-10-17
  • 2021-12-23
  • 2021-12-25
  • 2021-08-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-01-06
  • 2021-05-19
  • 2021-08-10
相关资源
相似解决方案