sonar8.9版本 win10安装使用手册

这篇具有很好参考价值的文章主要介绍了sonar8.9版本 win10安装使用手册。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1. 安装包准备:

注意:不同版本之间是有兼容性问题的,可参考官方推荐版本

下载地址

sonarqube 版本:8.9.9.56886 说明:snoar服务器

sonar-pdfplugin 版本:3.x 说明:测试报告生成pdf插件

sonarscanner 版本:4.7.0.2747-windows 说明:扫描器

sonarqube-community-branch-plugin-1.8.0.jar 说明:指定扫描分支,不安装,默认扫描master分支

java环境:jdk 11

2. 环境准备

配置系统环境变量

2.1 配置sonar-scanner
变量名:SONAR_SCANNER_HOME
变量值(安装包所在位置):D:\work\soft\sonarqube\sonar-scanner-4.7.0.2747-windows
path新增:%SONAR_SCANNER_HOME%\bin

验证:

$ sonar-scanner -v
INFO: Scanner configuration file: D:\work\soft\sonarqube\sonar-scanner-
4.7.0.2747-windows\bin\..\conf\sonar-scanner.properties
INFO: SonarScanner 4.7.0.2747
INFO: Java 11.0.14.1 Eclipse Adoptium (64-bit)
INFO: Windows 10 10.0 amd64
2.2 配置sonarQube
  1. 配置jdk11的环境
变量名:JAVA_HOME11
变量值(安装包所在位置):D:\work\soft\jdk-11.0.16.1_windows-x64_bin\jdk-11.0.16.1
path新增:%JAVA_HOME11%\bin
  1. 修改\conf\wrapper.conf配置文件

    # Path to JVM executable. By default it must be available in PATH.
    # Can be an absolute path, for example:
    wrapper.java.command=D:/tools/jdk-11.0.16.1_windows-x64_bin/jdk-11.0.16.1/bin/java.exe
    #wrapper.java.command=java
    #
    # DO NOT EDIT THE FOLLOWING SECTIONS
    #
    
    
    #********************************************************************
    # Wrapper Java
    #********************************************************************
    wrapper.java.additional.1=-Dsonar.wrapped=true
    wrapper.java.additional.2=-Djava.awt.headless=true
    wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
    wrapper.java.classpath.1=../../lib/sonar-application-8.9.9.56886.jar
    wrapper.java.classpath.2=../../lib/jsw/wrapper-3.2.3.jar
    wrapper.java.classpath.3=../../lib/sonar-shutdowner-8.9.9.56886.jar
    wrapper.java.library.path.1=./lib
    wrapper.app.parameter.1=org.sonar.application.App
    wrapper.java.initmemory=8
    wrapper.java.maxmemory=32
    
    #********************************************************************
    # Wrapper Logs
    #********************************************************************
    
    wrapper.console.format=PM
    wrapper.console.loglevel=INFO
    wrapper.logfile.format=M
    wrapper.logfile.loglevel=INFO
    wrapper.logfile.rollmode=DATE
    wrapper.logfile=../../logs/sonar.YYYYMMDD.log
    
    # Maximum size that the log file will be allowed to grow to before
    #  the log is rolled. Size is specified in bytes.  The default value
    #  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
    #  'm' (mb) suffix.  For example: 10m = 10 megabytes.
    #wrapper.logfile.maxsize=0
    
    # Maximum number of rolled log files which will be allowed before old
    #  files are deleted.  The default value of 0 implies no limit.
    wrapper.logfile.maxfiles=7
    
    # Log Level for sys/event log output.  (See docs for log levels)
    wrapper.syslog.loglevel=NONE
    
    #********************************************************************
    # Wrapper Windows Properties
    #********************************************************************
    # Title to use when running as a console
    wrapper.console.title=SonarQube
    
    # Disallow start of multiple instances of an application at the same time on Windows
    wrapper.single_invocation=true
    
    #********************************************************************
    # Wrapper Windows NT/2000/XP Service Properties
    #********************************************************************
    # WARNING - Do not modify any of these properties when an application
    #  using this configuration file has been installed as a service.
    #  Please uninstall the service before modifying this section.  The
    #  service can then be reinstalled.
    
    # Name of the service
    wrapper.ntservice.name=SonarQube
    
    # Display name of the service
    wrapper.ntservice.displayname=SonarQube
    
    # Description of the service
    wrapper.ntservice.description=SonarQube
    
    # Service dependencies.  Add dependencies as needed starting from 1
    wrapper.ntservice.dependency.1=
    
    # Mode in which the service is installed.  AUTO_START or DEMAND_START
    wrapper.ntservice.starttype=AUTO_START
    
    # Allow the service to interact with the desktop.
    wrapper.ntservice.interactive=false
    
    #********************************************************************
    # Forking Properties
    #********************************************************************
    wrapper.disable_restarts=TRUE
    wrapper.ping.timeout=0
    wrapper.shutdown.timeout=0
    wrapper.jvm_exit.timeout=0
    
    
  2. 将下载的sonarqube-community-branch-plugin-1.8.0.jar插件放到\sonarqube-8.9.9.56886\extensions\plugins\目录下

  3. 修改\conf\sonar.properties

# WEB SERVER
sonar.web.javaAdditionalOpts=-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-1.8.0.jar=web
sonar.ce.javaAdditionalOpts=-javaagent:./extensions/plugins/sonarqube-community-branch-plugin-1.8.0.jar=ce

-Dsonar.pdf.username=admin
-Dsonar.pdf.password=admin


3. 运行snoarQube

在\sonarqube-8.9.9.56886\bin\windows-x86-64\下,运行StartSonar.bat文件

第一次运行时会要求要修改密码,根据提示修改密码

账号:admin
修改后密码:admin123

4.sonarQube的配置项目

4.1创建项目

sonarqube win安装教程,工具类的使用,springboot,java,spring boot,单元测试

4.2访问授权令牌

sonarqube win安装教程,工具类的使用,springboot,java,spring boot,单元测试

4.3生成令牌

sonarqube win安装教程,工具类的使用,springboot,java,spring boot,单元测试

4.4maven扫描运行方式

sonarqube win安装教程,工具类的使用,springboot,java,spring boot,单元测试

5.springcloud项目的配置

5.1添加配置文件sonar-project.properties

在被扫描的项目/模块路径下新增配置文件sonar-project.properties

配置文件内容文章来源地址https://www.toymoban.com/news/detail-818437.html

# must be unique in a given SonarQube instance
sonar.projectKey=test-service

# --- optional properties ---

# defaults to project key
#sonar.projectName=My project
sonar.projectName=test-service
# defaults to 'not provided'
#sonar.projectVersion=1.0
sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Defaults to .
#sonar.sources=.

# 源代码目录,如果多个使用","分割 例如:mode1/src/main,mode2/src/main
sonar.sources=src/main/java

# 单元测试目录,如果多个使用","分割 例如:mode1/src/test,mode2/src/test
sonar.tests=src/test/java

# java字节码目录
sonar.java.binaries=target/classes

# 单元测试报告目录
#sonar.junit.reportsPath=target/surefire-reports

sonar.coverage.jacoco.xmlReportPaths=target/surefire-reports
# 代码覆盖率插件
sonar.java.coveragePlugin=jacoco

# jacoco.exec文件路径
sonar.jacoco.reportPath=target/coverage-reports/jacoco.exec


# 忽略的目录
#sonar.exclusions=*/src/test/**/*

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

sonar.login=admin
sonar.password=admin123
5.2pom.xml

在项目的父pom中添加依赖和插件依赖

   <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
        </dependency>
        <!-- Jacoco dependencies. -->
        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.6</version>
        </dependency>
     <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- 单元测试 -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

   <plugin>
                <!-- Configures the compiler. -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <compilerArgs>
                        <arg>-Xlint</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <version>2.22.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!-- Code coverage plugin. -->
                <!-- This sets up code coverage for the unit tests, the integration tests, -->
                <!-- and the combined coverage of both. -->
                <!-- After running a `mvn clean install`, open `target/site/jacoco-both/index.html` in a browser. -->
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.6</version>
                <configuration>
                    <includes> <!--覆盖率计算包含的类-->
                        <include>**/controller/**/*</include>
                        <include>**/service/**/*</include>
                    </includes>
                    <excludes> <!--排除像entity、配置等无单元测试意义的类。如有,在Sonar服务端也需要配合排除(Ignore Code Coverage: https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/#header-5)-->
                        <exclude>**/config/**/*</exclude>
                        <exclude>**/entity/**/*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>jacoco-initialize</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>  
    
5.3执行扫描

在sonar-project.properties文件所在位置执行命令

mvn clean verify sonar:sonar -Dsonar.branch.name=develop

6. vue项目的配置

6.1 添加配置文件sonar-project.properties

在被扫描的项目/模块路径下新增配置文件sonar-project.properties

配置文件内容

# must be unique in a given SonarQube instance
sonar.projectKey=web-service

# --- optional properties ---

# defaults to project key
#sonar.projectName=My project
sonar.projectName=web-service
# defaults to 'not provided'
#sonar.projectVersion=1.0
# 中文的字段需要用Unicode转码,展示到sonarqube的web中才不会乱码
sonar.projectName=\u6d4b\u8bd5\u9879\u76ee

# 可用的配置项
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=./src
sonar.exclusions=/node_modules/
sonar.tests=./src
sonar.test.inclusions=**/*.spec.ts

# \u5FFD\u7565\u7684\u76EE\u5F55
#sonar.exclusions=*/src/test/**/*

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

sonar.login=admin
sonar.password=admin123
6.2 在sonar-project.properties文件所在位置执行命令
sonar-scanner.bat -D"sonar.projectKey=web-service" -D"sonar.sources=." -D"sonar.host.url=http://localhost:9000" -D"sonar.login=admin" -D"sonar.branch.name=dev"

到了这里,关于sonar8.9版本 win10安装使用手册的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 开源元数据管理平台Datahub最新版本0.10.5——安装部署手册(附离线安装包)

    开源元数据管理平台Datahub最新版本0.10.5——安装部署手册(附离线安装包)

    大家好,我是独孤风。 开源元数据管理平台Datahub近期得到了飞速的发展。已经更新到了0.10.5的版本,来咨询我的小伙伴也越来越多,特别是安装过程有很多问题。本文经过和群里大伙伴的共同讨论,总结出安装部署Datahub最新版本的部署手册,希望能帮助到大家。 文章较长,

    2024年02月14日
    浏览(7)
  • 元数据管理平台Datahub0.10.5版本安装部署与导入各种元数据手册

    元数据管理平台Datahub0.10.5版本安装部署与导入各种元数据手册

    官网文档连接 DataHub Quickstart Guide | DataHub (datahubproject.io) 本文所选择的Python的版本为3.8.16,Docker版本为20.10.0,Datahub为0.10.5版本 python必须为3.7以上的版本。0.10.5不支持以下的版本 如果要使用web上的 添加数据源  直接调用的python和pip命令 需要把环境变量设置过去。不能用pyth

    2024年02月07日
    浏览(15)
  • WIN10安装MXNET GPU版本

    WIN10安装MXNET GPU版本

    1. 下载Visual Studio Community 2019  Visual Studio 2019 系统要求 | Microsoft Learn 2. 安装CUDA、cuDNN CUDA Toolkit - Free Tools and Training | NVIDIA Developer CUDA Deep Neural Network (cuDNN) | NVIDIA Developer 【Windows11】Cuda和Cudnn详细安装教程_Jin·的博客-CSDN博客_cudnn安装 3. 安装opencv与openBLAS Home - OpenCV 环境变量添

    2024年02月07日
    浏览(6)
  • 【项目实战】自定义设置Sonar的规则,要求DevOps工具链SonarQube只扫描指定模块

    开发微服务项目,很多会基于网络上现成开源的微服务框架进行二开,公司有单元测试覆盖率的要求,往往会使用SonarQube 来实现扫描代码的单元测试覆盖率,但是因为网络上现成开源的微服务框架很大部分是已经现成的代码,因此补充单元测试工作会很痛苦,于是,可以自定

    2024年02月14日
    浏览(4)
  • Win10 OpenCV编译安装CUDA版本

    Win10 OpenCV编译安装CUDA版本

    Win10 + Microsoft Visual Studio Community 2017 + CUDA11.3 + CUDNN8.2 + RTX GeForce 3090 + OpenCV4.5.3 前往官网下载Visual Studio Installer即可,做如下勾选,安装即可 完成后,查看环境变量,将MSVC编译器地址加入环境变量 前往官网下载CUDA和对应的CUDNN,切记一定要对应CUDNN和CUDA版本,根据提示一步一

    2024年02月06日
    浏览(11)
  • win10适合安装哪个版本的office

    win10适合安装哪个版本的office

    office是现在很多办公、学习都要使用的软件,它有着word、excel等多种常用工具。很多朋友在使用win10时都不知道win10系统兼容哪些版本的office,下面就跟着小编一起来看一下吧。 win10兼容哪些版本office  所有版本的office都是可以兼容的。还是建议安装较新的版本 office各个版本

    2024年02月04日
    浏览(3)
  • Win10安装GPU支持的最新版本的tensorflow

    Win10安装GPU支持的最新版本的tensorflow

    我在安装好cuda和cudnn后,使用pip install tensorflow安装的tensorflow都提示不能找到GPU, 为此怀疑默认暗转的tensorflow是不带GPU支持的。 在tensorflow官网提供了多个版本的GPU支持的windows的安装包 https://www.tensorflow.org/install/pip?hl=zh-cn#system-install 下载后再安装就可以成功安装GPU支持的t

    2024年02月13日
    浏览(7)
  • Win 10 MySQL 安装详细教程(版本:8.2.0 Innovation)

    Win 10 MySQL 安装详细教程(版本:8.2.0 Innovation)

            下载地址: https://dev.mysql.com/downloads/mysql/          选择需要安装的版本若下拉框没有需求版本 详见步骤2         下载地址:  https://downloads.mysql.com/archives/community/         MySQL压缩包解压到任意目录 (可以根据自己的盘符目录选择)         ①进入M

    2024年02月02日
    浏览(19)
  • Win10同时安装MYSQL5.7和MYSQL8.0版本

    Win10同时安装MYSQL5.7和MYSQL8.0版本

    官网下载网址:https://dev.mysql.com/downloads/ 2.1、解压文件夹,然后新建一个 my.ini 文件 my.ini文件内容: 2.2、以 管理员身份运行 cmd命令提示符,切换到 bin 路径下。 输入命令: mysqld --initialize --console 然后记住随机密码 2.3、安装MySQL5服务 【my.ini更改为自己的安装路径!!!管理员

    2024年02月10日
    浏览(5)
  • Win7环境64win操作系统,安装microsoft office2010 时MSXML版本6.10.1129.0,无法安装的解决办法

    Win7环境64win操作系统,安装microsoft office2010 时MSXML版本6.10.1129.0,无法安装的解决办法

    ** 第一步 :在百度搜索MSXML6.10.1129.0软件进行下载,大概就是5M左右的大小,下载后解压,选择 第二项进行安装。 第二步: 按照https://mip.win7zhijia.cn/jiaocheng/win7_41377.html进行修改注册表。 但是往往按照以上步骤修改完注册表后还是不能正常安装。 原因是修改注册表时出错,如

    2024年02月12日
    浏览(9)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包