Fixing 'Class is not accessible through the ClassLoader.' warning with Jenkins, SonarQube, and Gradle

前端 未结 2 1862
眼角桃花
眼角桃花 2021-01-01 03:28

When SonarQube analyzes my Java project which is built using Gradle and Jenkins, I get a lot of warnings about third party libraries not being accessible through the ClassLo

2条回答
  •  -上瘾入骨i
    2021-01-01 03:42

    You'll have to set sonar.libraries. But in order to set this property manually, you'll have to define a Gradle task that copies all external dependencies to a lib directory, and then use sonar.libraries=path/to/lib/*.jar to reference them. Instead, I'd invoke Sonar via the sonar-runner Gradle plugin, which will take care of setting the above properties (plus sonar.libraries and others) for you.

提交回复
热议问题