zoukankan      html  css  js  c++  java
  • windows下代码规范检测工具sonarqube安装与使用,含与maven的结合

    一、首先下载sonarqube   地址 : https://www.sonarqube.org/downloads/   (最新版本支持java11+,博主下载支持java8的版本7.7),

        下载SonarScanner   地址:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/

    需要注意的是该版本对应的是mysql5.7,不能是mysql8

    二、windows 安装

      mysql5.7安装好创建sonar数据库

      解压下载好的sonarQube7.7

     配置conf中的sonar.properties

    ##数据库配置

      sonar.jdbc.username=root

      sonar.jdbc.password=********

      sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false

      ## 下面设定访问网址为 http://localhost:9000

      sonar.web.host=0.0.0.0

      sonar.web.port=9000

      sonar.web.context=xxxx

    启动、打开sonar/bin,进入相对应系统的文件夹下,重启服务:StartSonar.bat

      由于要进行数据库初始化,所以这次会有点慢。(如果不成功,请查看数据库是否成功创建并具有相应的权限)

    启动成功如下:

     输入localhost:9000登陆,用户名密码都是admin

     汉化包地址:https://github.com/SonarQubeCommunity/sonar-l10n-zh,直接下载对应版本

     将下载的汉化包放入sonarqube-7.7extensionsplugins目录下,重启服务

     三、项目中的使用

    安装sonarScanner,注意windows和linux是不同的,在对应环境用对应包

     需要配置好sonarScanner

    打开要进行代码分析的项目根目录,新建sonar-project.properties文件

    sonar-project.properties内容如下:

    # must be unique in a given SonarQube instance
    #projectName是项目名称
    sonar.projectKey=项目名称
    
    # this is the name displayed in the SonarQube UI
    
    sonar.projectName=hnsi-calc-ybjs-service
    
    sonar.projectVersion=1.0
    
    # Path is relative to the sonar-project.properties file. Replace "" by "/" on Windows.
    
    # Since SonarQube 4.2, this property is optional if sonar.modules is set.
    
    # If not set, SonarQube starts looking for source code from the directory containing
    
    # the sonar-project.properties file.
    #sources是源文件所在的目录
    sonar.sources=src
    #binaries是class文件所在的目录
    sonar.java.binaries=target
    
    sonar.language=java
    
    # Encoding of the source code. Default is default system encoding
    
    sonar.sourceEncoding=UTF-8

    启动sonarqube服务。

    并启动cmd,在cmd进入项目所在的根目录,输入命令:sonar-scanner进行分析,

    分析成功后

     查看web浏览器

     点开

    四、与maven的结合使用

    可以参考官网描述https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/

    需要setting.xml的配置及插件

    setting.xml配置,添加

    <profile>
                <id>sonar</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                    <sonar.host.url>http://localhost:9000</sonar.host.url>
                    <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
                    <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
                    <sonar.jdbc.username>root</sonar.jdbc.username>
                    <sonar.jdbc.password>123456</sonar.jdbc.password>
                </properties>
            </profile>

    完整配置如下:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository>G:/sharp/repo</localRepository>
     <servers>  
          <server>  
            <id>nexus-snapshots</id>  
             <username>xxx</username>
           <password>xxx</password>
        </server>  
      </servers>
      
              
      <mirrors>
      
      </mirrors>  
      
      <profiles>
        <profile>
       <repositories>
        <repository>
          <id>central</id>
          <name>Central Repository</name>
          <url>http://repo.maven.apache.org/maven2</url>
          <layout>default</layout>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
    
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <name>Central Repository</name>
          <url>http://repo.maven.apache.org/maven2</url>
          <layout>default</layout>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <updatePolicy>never</updatePolicy>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    
       
        </profile>
        
        <profile>
                <id>sonar</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                    <sonar.host.url>http://localhost:9000</sonar.host.url>
                    <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
                    <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
                    <sonar.jdbc.username>root</sonar.jdbc.username>
                    <sonar.jdbc.password>123456</sonar.jdbc.password>
                </properties>
            </profile>
            
      </profiles>
      <activeProfiles>
        <activeProfile>nexus</activeProfile>
      </activeProfiles>
    
     </settings>

    pom中添加对应版本的sonar插件

      <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.6.0.1398</version>
                </plugin>

    本次实验是在common项目下进行

    idea中采用命令方式打包:mvn clean install sonar:sonar

    如下:

      1 Microsoft Windows [版本 6.1.7601]
      2 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
      3 
      4 G:drawnbluespringcloud-alibabacommon>mvn clean install sonar:sonar
      5 [INFO] Scanning for projects...
      6 [INFO]
      7 [INFO] ------------------------------------------------------------------------
      8 [INFO] Building common 0.0.1-SNAPSHOT
      9 [INFO] ------------------------------------------------------------------------
     10 [INFO]
     11 [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ common ---
     12 [INFO] Deleting G:drawnbluespringcloud-alibabacommon	arget
     13 [INFO]
     14 [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ common ---
     15 [INFO] Using 'UTF-8' encoding to copy filtered resources.
     16 [INFO] Copying 1 resource
     17 [INFO] Copying 0 resource
     18 [INFO]
     19 [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ common ---
     20 [INFO] Changes detected - recompiling the module!
     21 [INFO] Compiling 5 source files to G:drawnbluespringcloud-alibabacommon	argetclasses
     22 [INFO]
     23 [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ common ---
     24 [INFO] Using 'UTF-8' encoding to copy filtered resources.
     25 [INFO] skip non existing resourceDirectory G:drawnbluespringcloud-alibabacommonsrc	est
    esources
     26 [INFO]
     27 [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ common ---
     28 [INFO] Changes detected - recompiling the module!
     29 [INFO] Compiling 1 source file to G:drawnbluespringcloud-alibabacommon	arget	est-classes
     30 [INFO]
     31 [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ common ---
     32 [INFO]
     33 [INFO] -------------------------------------------------------
     34 [INFO]  T E S T S
     35 [INFO] -------------------------------------------------------
     36 [INFO] Running com.drawnblue.common.CommonApplicationTests
     37 14:32:26.305 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.drawnblue.common.CommonApplicationTests]
     38 14:32:26.310 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
     39 14:32:26.316 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springfram
     40 ework.test.context.CacheAwareContextLoaderDelegate)]
     41 14:32:26.334 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.drawnblue.common.CommonApplicationTests] from class [org.springframework.boot.test.context.Spr
     42 ingBootTestContextBootstrapper]
     43 14:32:26.345 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.drawnblue.common.CommonApplicationTests], using Spr
     44 ingBootContextLoader
     45 14:32:26.348 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.drawnblue.common.CommonApplicationTests]: class path resource [com/drawnblue
     46 /common/CommonApplicationTests-context.xml] does not exist
     47 14:32:26.348 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.drawnblue.common.CommonApplicationTests]: class path resource [com/drawnblue
     48 /common/CommonApplicationTestsContext.groovy] does not exist
     49 14:32:26.349 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.drawnblue.common.CommonApplicationTests]: no resource found for suffixes {
     50 -context.xml, Context.groovy}.
     51 14:32:26.350 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.drawnblue.common.CommonApplicationTests]: CommonApplicatio
     52 nTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
     53 14:32:26.388 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.drawnbl
     54 ue.common.CommonApplicationTests]
     55 14:32:26.450 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [G:drawnbluespringcloud-alibabacommon	argetclassescomdrawnbluecomm
     56 onCommonApplication.class]
     57 14:32:26.452 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.drawnblue.common.CommonApplication for test class com.drawnblue.common.CommonApplicationTests
     58 14:32:26.522 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.drawnblue.common.CommonApplicationTests]: using defaults.
     59 14:32:26.523 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.m
     60 ockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.a
     61 utoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.ser
     62 vlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.su
     63 pport.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.t
     64 est.context.jdbc.SqlScriptsTestExecutionListener]
     65 14:32:26.529 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] due to a missing de
     66 pendency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [javax/servlet/ServletContext]
     67 14:32:26.531 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due t
     68 o a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
     69 14:32:26.531 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missin
     70 g dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
     71 14:32:26.531 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@795cd85e,
     72 org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@59fd97a8, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@f5ac9e4, org.springframework.test.context.support.D
     73 irtiesContextTestExecutionListener@123ef382, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@dbf57b3, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@384ad17b, org.sp
     74 ringframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@61862a7f, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@441772e, org.sprin
     75 gframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@7334aada]
     76 14:32:26.533 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.drawnblue.common.CommonApplicationTests]
     77 14:32:26.533 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.drawnblue.common.CommonAppli
     78 cationTests]
     79 14:32:26.534 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.drawnblue.common.CommonApplicationTests]
     80 14:32:26.534 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.drawnblue.common.CommonAppli
     81 cationTests]
     82 14:32:26.535 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.drawnblue.common.CommonApplicationTests]
     83 14:32:26.535 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.drawnblue.common.CommonAppli
     84 cationTests]
     85 14:32:26.538 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@4466af20 testClass = CommonApplicationTests, testInstance = [null],
     86 testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@a514af7 testClass = CommonApplicationTests, locations = '{}', classes = '{class com.drawnblue.common.CommonApplication}', cont
     87 extInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.sprin
     88 gframework.boot.test.context.filter.ExcludeFilterContextCustomizer@1a1d6a08, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@436e852b, org.springframework.boot.
     89 test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@670b40af, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.sp
     90 ringframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@612679d6], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty
     91 ]]], class annotated with @DirtiesContext [false] with mode [null].
     92 14:32:26.539 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.drawnblue.common.CommonApplicationTests]
     93 14:32:26.539 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.drawnblue.common.CommonAppli
     94 cationTests]
     95 14:32:26.542 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext@4466af20 testClass = CommonApplicationTests, tes
     96 tInstance = com.drawnblue.common.CommonApplicationTests@dd8ba08, testMethod = [null], testException = [null], mergedContextConfiguration = [MergedContextConfiguration@a514af7 testClass = CommonApplicationTests, locations = '{}',
     97  classes = '{class com.drawnblue.common.CommonApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootT
     98 estContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@1a1d6a08, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$Duplica
     99 teJsonObjectContextCustomizer@436e852b, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@670b40af, org.springframework.boot.test.au
    100 toconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@612679d6], contextLoader = 'org.springframework.boot.test.context.Sp
    101 ringBootContextLoader', parent = [null]], attributes = map[[empty]]]].
    102 14:32:26.559 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstr
    103 apper=true, server.port=-1}
    104 
    105   .   ____          _            __ _ _
    106  /\ / ___'_ __ _ _(_)_ __  __ _    
    107 ( ( )\___ | '_ | '_| | '_ / _` |    
    108  \/  ___)| |_)| | | | | || (_| |  ) ) ) )
    109   '  |____| .__|_| |_|_| |_\__, | / / / /
    110  =========|_|==============|___/=/_/_/_/
    111  :: Spring Boot ::        (v2.1.6.RELEASE)
    112 
    113 2019-09-27 14:32:26.726  INFO 4852 --- [           main] c.d.common.CommonApplicationTests        : Starting CommonApplicationTests on hh-PC with PID 4852 (started by Administrator in G:drawnbluespringcloud-alibabacommon)
    114 2019-09-27 14:32:26.727  INFO 4852 --- [           main] c.d.common.CommonApplicationTests        : No active profile set, falling back to default profiles: default
    115 2019-09-27 14:32:27.066  INFO 4852 --- [           main] c.d.common.CommonApplicationTests        : Started CommonApplicationTests in 0.506 seconds (JVM running for 1.1)
    116 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.999 s - in com.drawnblue.common.CommonApplicationTests
    117 [INFO]
    118 [INFO] Results:
    119 [INFO]
    120 [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    121 [INFO]
    122 [INFO]
    123 [INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ common ---
    124 [INFO] Building jar: G:drawnbluespringcloud-alibabacommon	argetcommon-0.0.1-SNAPSHOT.jar
    125 [INFO]
    126 [INFO] --- spring-boot-maven-plugin:2.1.6.RELEASE:repackage (repackage) @ common ---
    127 [INFO] Replacing main artifact with repackaged archive
    128 [INFO]
    129 [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ common ---
    130 [INFO] Installing G:drawnbluespringcloud-alibabacommon	argetcommon-0.0.1-SNAPSHOT.jar to C:UsersAdministrator.m2
    epositorycomdrawnbluecommon.0.1-SNAPSHOTcommon-0.0.1-SNAPSHOT.jar
    131 [INFO] Installing G:drawnbluespringcloud-alibabacommonpom.xml to C:UsersAdministrator.m2
    epositorycomdrawnbluecommon.0.1-SNAPSHOTcommon-0.0.1-SNAPSHOT.pom
    132 [INFO]
    133 [INFO] ------------------------------------------------------------------------
    134 [INFO] Building common 0.0.1-SNAPSHOT
    135 [INFO] ------------------------------------------------------------------------
    136 [INFO]
    137 [INFO] --- sonar-maven-plugin:3.6.0.1398:sonar (default-cli) @ common ---
    138 [INFO] User cache: C:UsersAdministrator.sonarcache
    139 [INFO] SonarQube version: 7.7.0
    140 [INFO] Default locale: "zh_CN", source code encoding: "UTF-8"
    141 [INFO] Load global settings
    142 [INFO] Load global settings (done) | time=94ms
    143 [INFO] Server id: 49B321BC-AW1wY6hGXgbphgfNsIsZ
    144 [INFO] User cache: C:UsersAdministrator.sonarcache
    145 [INFO] Load/download plugins
    146 [INFO] Load plugins index
    147 [INFO] Load plugins index (done) | time=42ms
    148 [INFO] Plugin [l10nzh] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
    149 [INFO] Load/download plugins (done) | time=64ms
    150 [INFO] Process project properties
    151 [INFO] Execute project builders
    152 [INFO] Execute project builders (done) | time=3ms
    153 [INFO] Project key: com.drawnblue:common
    154 [INFO] Base dir: G:drawnbluespringcloud-alibabacommon
    155 [INFO] Working dir: G:drawnbluespringcloud-alibabacommon	argetsonar
    156 [INFO] Load project settings for component key: 'com.drawnblue:common'
    157 [INFO] Load project settings for component key: 'com.drawnblue:common' (done) | time=49ms
    158 [INFO] Load project repositories
    159 [INFO] Load project repositories (done) | time=80ms
    160 [INFO] Load quality profiles
    161 [INFO] Load quality profiles (done) | time=29ms
    162 [INFO] Load active rules
    163 [INFO] Load active rules (done) | time=423ms
    164 [WARNING] SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
    165 [INFO] Indexing files...
    166 [INFO] Project configuration:
    167 [INFO] 7 files indexed
    168 [INFO] Quality profile for java: Sonar way
    169 [INFO] Quality profile for xml: Sonar way
    170 [INFO] ------------- Run sensors on module common
    171 [INFO] Load metrics repository
    172 [INFO] Load metrics repository (done) | time=17ms
    173 [INFO] Sensor JavaSquidSensor [java]
    174 [INFO] Configured Java source version (sonar.java.source): 8
    175 [INFO] JavaClasspath initialization
    176 [INFO] JavaClasspath initialization (done) | time=11ms
    177 [INFO] JavaTestClasspath initialization
    178 [INFO] JavaTestClasspath initialization (done) | time=3ms
    179 [INFO] Java Main Files AST scan
    180 [INFO] 5 source files to be analyzed
    181 [INFO] 5/5 source files have been analyzed
    182 [WARNING] Classes not found during the analysis : [javax.annotation.meta.When]
    183 [INFO] Java Main Files AST scan (done) | time=693ms
    184 [INFO] Java Test Files AST scan
    185 [INFO] 1 source files to be analyzed
    186 [WARNING] Unable to create a corresponding matcher for custom assertion method, please check the format of the following symbol: ''
    187 [INFO] 1/1 source files have been analyzed
    188 [INFO] Java Test Files AST scan (done) | time=30ms
    189 [INFO] Sensor JavaSquidSensor [java] (done) | time=1182ms
    190 [INFO] Sensor JaCoCo XML Report Importer [jacoco]
    191 [INFO] Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
    192 [INFO] Sensor SurefireSensor [java]
    193 [INFO] parsing [G:drawnbluespringcloud-alibabacommon	argetsurefire-reports]
    194 [INFO] Sensor SurefireSensor [java] (done) | time=26ms
    195 [INFO] Sensor JaCoCoSensor [java]
    196 [INFO] Sensor JaCoCoSensor [java] (done) | time=1ms
    197 [INFO] Sensor JavaXmlSensor [java]
    198 [INFO] 1 source files to be analyzed
    199 [INFO] Sensor JavaXmlSensor [java] (done) | time=112ms
    200 [INFO] Sensor HTML [web]
    201 [INFO] 1/1 source files have been analyzed
    202 [INFO] Sensor HTML [web] (done) | time=12ms
    203 [INFO] Sensor XML Sensor [xml]
    204 [INFO] 1 source files to be analyzed
    205 [INFO] Sensor XML Sensor [xml] (done) | time=106ms
    206 [INFO] 1/1 source files have been analyzed
    207 [INFO] ------------- Run sensors on project
    208 [INFO] Sensor Zero Coverage Sensor
    209 [INFO] Sensor Zero Coverage Sensor (done) | time=11ms
    210 [INFO] Sensor Java CPD Block Indexer
    211 [INFO] Sensor Java CPD Block Indexer (done) | time=19ms
    212 [INFO] No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
    213 [INFO] 2 files had no CPD blocks
    214 [INFO] Calculating CPD for 3 files
    215 [INFO] CPD calculation finished
    216 [INFO] Analysis report generated in 67ms, dir size=105 KB
    217 [INFO] Analysis report compressed in 27ms, zip size=26 KB
    218 [INFO] Analysis report uploaded in 141ms
    219 [INFO] ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=com.drawnblue%3Acommon
    220 [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
    221 [INFO] More about the report processing at http://localhost:9000/api/ce/task?id=AW1xa8yJFapCHcyRPg9i
    222 [INFO] Analysis total time: 3.960 s
    223 [INFO] ------------------------------------------------------------------------
    224 [INFO] BUILD SUCCESS
    225 [INFO] ------------------------------------------------------------------------
    226 [INFO] Total time: 9.655 s
    227 [INFO] Finished at: 2019-09-27T14:32:33+08:00
    228 [INFO] Final Memory: 63M/563M
    229 [INFO] ------------------------------------------------------------------------
    230 
    231 G:drawnbluespringcloud-alibabacommon>
    View Code

    打包成功,查看

     common已经分析完成。

  • 相关阅读:
    JavaScript中的闭包
    SQL 备忘
    SqlServer 2005 升级至SP2过程中出现"身份验证"无法通过的问题
    unable to start debugging on the web server iis does not list an application that matches the launched url
    Freebsd 编译内核
    Freebsd 6.2中关于无线网络的设定
    【Oracle】ORA01219
    【Linux】Windows到Linux的文件复制
    【Web】jar命令行生成jar包
    【Linux】CIFS挂载Windows共享
  • 原文地址:https://www.cnblogs.com/xiaoyao-001/p/11555896.html
Copyright © 2011-2022 走看看