windows 下 sonarqube-8.6.0.39681 配置以及使用

本文介绍快速启动 Demo 版 Sonarqube 的方法,包括 maven 配置、在项目中进行 Sonarqube 配置并添加 plugin,使用官方 maven 源。还说明了 Sonarqube 的使用,如生成项目、生成 Token 以及在项目根目录下执行相关操作,并给出参考链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以下只是个人解决的配置,不一定有通用性。

快速启动一个 Demo 版 sonarqube

demo 官方教程,快速启动 sonarqube

配置

maven 配置 settings.xml

  <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                   http://localhost:9000
                </sonar.host.url>
            </properties>
        </profile>
  </profiles>

配置项目中的 pom.xml

sonarqube 配置
<profiles>

      <profile>
         <id>sonar</id>
         <activation>
            <activeByDefault>true</activeByDefault>
         </activation>
         <properties>
            <!-- Optional URL to server. Default value is http://localhost:9000 -->
            <sonar.host.url>
               http://127.0.0.1:9000
            </sonar.host.url>

         </properties>
      </profile>

</profiles>
<plugins></plugins> 下添加 plugin
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-plugin-plugin</artifactId>
   <version>2.5.1</version>
   <configuration>
      <goalPrefix>lifecycle-mapping</goalPrefix>
   </configuration>
   <executions>
      <execution>
         <id>generated-helpmojo</id>
         <goals>
            <goal>helpmojo</goal>
         </goals>
      </execution>
   </executions>
</plugin>

pom.xml 使用官方的 maven 源

<pluginRepositories>

   <pluginRepository>
      <id>maven2</id>
      <url>https://repo.maven.apache.org/maven2/</url>
   </pluginRepository>

</pluginRepositories>

sonarqube 使用

生成一个项目

在这里插入图片描述

生成 Token

在这里插入图片描述

项目根目录下执行

在这里插入图片描述

References

  1. sonarqube-download
  2. get-started-2-minutes
  3. https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值