Sonar properties files

前端 未结 3 426
不知归路
不知归路 2020-12-15 23:14

I have a project that has the following package structure

src/main/proj
    -com.company.package
        -appName
            -morepackages

        -appVers         


        
相关标签:
3条回答
  • 2020-12-15 23:20

    Do the build job on Jenkins first without Sonar configured. Then add Sonar, and run a build job again. Should fix the problem

    0 讨论(0)
  • 2020-12-15 23:37

    You have to specify the projectBaseDir if the module name doesn't match you module directory.

    Since both your module are located in ".", you can simply add the following to your sonar-project properties:

    module1.sonar.projectBaseDir=.
    module2.sonar.projectBaseDir=.
    

    Sonar will handle your modules as components of the project:

    Result of Sonar analysis

    EDIT

    If both of your modules are located in the same source directory, define the same source folder for both and exclude the unwanted packages with sonar.exclusions:

    module1.sonar.sources=src/main/java
    module1.sonar.exclusions=app2code/**/*
    
    module2.sonar.sources=src/main/java
    module2.sonar.exclusions=app1code/**/*
    

    More details about file exclusion

    0 讨论(0)
  • 2020-12-15 23:47

    You can define a Multi-module project structure, then you can set the configuration for sonar in one properties file in the root folder of your project, (Way #1)

    0 讨论(0)
提交回复
热议问题