Checkstyle plug-in in Jenkins does not output results with parser error

Asked 2 years ago, Updated 2 years ago, 113 views

Currently, Jenkins is building CI environment for Android project, but the Checkstyle plug-in is not working.

Operating System: Windows 7 64-bit/Ubuntu 16.04
Jenkins: 2.53
Checkstyle Plug-in: 3.47

And Prepare an Android SDK and create an environment where Gradle builds pass manually (both Windows and Linux).
②Added Gradle build to run shell in Jeninis task.Added check style execution.
③Run Build.

Checkstyle does not complete successfully with the following exceptions:

==Exception ==

 module: Failed to process file /var/lib/jenkins/workspace/LIBERTA-APP TEST/checkstyle-result.xml due to exception:
org.xml.sax.SAXException: Input stream is not a Checkstyle file.at Hudson.plugins.checkstyle.parser.CheckStyleParser.parse (CheckStyleParser.java:69)
at Hudson.plugins.analysis.core.AbstractAnnotationParser.parse (AbstractAnnotationParser.java:54)
at hudson.plugins.analysis.core.FilesParser.parseFile (FilesParser.java:323) 
at hudson.plugins.analysis.core.FilesParser.parseFiles(FilesParser.java:281) 
at hudson.plugins.analysis.core.FilesParser.parserCollectionOfFiles (FilesParser.java:232) 
at Hudson.plugins.analysis.core.FilesParser.invoke (FilesParser.java:203) 
at hudson.plugins.analysis.core.FilesParser.invoke (FilesParser.java:31) 
at Hudson.FilePath.act (FilePath.java:997) 
at Hudson.FilePath.act (FilePath.java:975) 
at Hudson.plugins.checkstyle.CheckStylePublisher.perform (CheckStylePublisher.java:78) 
at Hudson.plugins.analysis.core.HealthAwarePublisher.perform (HealthAwarePublisher.java:68) 
at hudson.plugins.analysis.core.HealthAwareRecorder.perform (HealthAwareRecorder.java:295) 
at Hudson.tasks.BuildStepCompatibilityLayer.perform (BuildStepCompatibilityLayer.java:81) 
at Hudson.tasks.BuildStepMonitor $1.perform (BuildStepMonitor.java:20) 
at Hudson.model.AbstractBuild$AbstractBuildExecution.perform (AbstractBuild.java:779) 
at Hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps (AbstractBuild.java:720) 
at Hudson.model.Build$BuildExecution.post2 (Build.java:186) 
at Hudson.model.AbstractBuild$AbstractBuildExecution.post 
at Hudson.model.Run.execute (Run.java:1760) 
at Hudson.model.FreeStyleBuild.run (FreeStyleBuild.java:43) 
at Hudson.model.ResourceController.execute (ResourceController.java:97)
at Hudson.model.Executor.run (Executor.java:405)

First, we checked the contents of the exception.

[Reference Site] [1]

https://github.com/jenkinsci/checkstyle-plugin/blob/master/src/main/java/hudson/plugins/checkstyle/parser/CheckStyleParser.java

module=(CheckStyle)digester.parse(new InputStreamReader(file, "UTF-8"));
if(module==null){
    through new SAXException("Input stream is not a Checkstyle file.");
}

The exception appeared to occur on line 69 above code.

The UTF-8 character code was specified and the check style xml was S-JIS, so
Before the build, we added the following commands to use the converted file:

#iconv-f SHIFT_JIS-t UTF-8./codingRule/JavaCodeStyle.xml-o./codingRule/utf.xml

I checked jenkins workspace, and it is true that the input file is UTF-8, but the situation remains the same.

The checkstyle.xml you are using is

http://checkstyle.sourceforge.net/google_style.html

Regarding the Google Java Terms and Conditions published in , the plug-in for Android Studio works fine.
As a trial, we have prepared a minimum configuration input file that does not include anything in the configuration for the following purposes, but the results remain the same.

== Minimum configuration XML ==

<?xml version="1.0" encoding="UTF-8"?>
<module name="Checker">
</module>

I tried and tried for a day, but I'm stuck.
If anyone has ever been in the same situation, could you help me?

xml jenkins

2022-09-29 22:19

1 Answers

Maybe

in Job Settings > Post-Build Actions > Checkstyle Alert Aggregation > File to Aggregate Do you have a style definition file (checkstyle.xml)?

If you set it like that...

This is where you can specify a report file to aggregate the results of checking styles, so
Gradle is

build/reports/checkstyle/*.xml

and so on.


2022-09-29 22:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.