-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeNarc sensor unable to resolve classes #27
Comments
Hi, I have the same problem with a Shared Pipeline Library analysing with SonarQube groovy plugin Sources are under src/ and vars/ directories (standard for this kind of project) Library is built with a maven project and compiled with gmaven-plus plugin And when analysing with Sonar 7.9 and sonar-groovy plugin 1.7, i have thousands lines in jenkins log like that :
How and where can i add something to resolve that ? Thank you |
We have exactly the same issue! Did anyone find a solution for this issue? Here are two sniplets from our jenkins console.log:
|
The issue is caused by the missing configuration of the CodeNarc runner's classpath when it is executed. I searched a little bit and this is how it is solve for the CodeNarc Ant target (see code): def oldContextClassLoader = currentThread().contextClassLoader
def classLoader = classLoaderForPaths(paths, oldContextClassLoader)
try {
currentThread().contextClassLoader = classLoader
return codeNarcRunner.execute()
} finally {
currentThread().contextClassLoader = oldContextClassLoader
classLoader.close()
} I think it should be possible to implement a similar mechanism for the SonarQube plugin. We have to define new properties:
SonarScanner generates Java properties when it is executed. One option would be to check how it is done and do the same. Another option would be to reuse the @TobiX what do you think? |
Maybe this will help: the SpotBugs plugin also needs the libraries to analyze a project; it uses the JavaResourceLocator from the sonar-java plugin to get the classpath: https://github.com/spotbugs/sonar-findbugs/blob/b3599e2c27471cfaf1c18bf726d31ea3b305cc4f/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java#L91 |
Hi, |
CodeNarc sensor reports a lot of errors like:
It looks for me that the sensor classpath is set improperly.
I created an example project which allows to reproduce the problem: https://github.com/agabrys/bugs-reports/tree/master/codenarc-CustomCompilerPhaseSourceDecorator
Environment:
The text was updated successfully, but these errors were encountered: