Simplified model to represent issues (based on Jenkins analysis-model)
URLs
-
Project home (this page)
| Do you want to improve this page? Please edit it on GitHub. |
Description
Background
Version 5.2.0 of the Jenkins plugin "Warnings Next Generation" supports different inputs with the "Warnings Plugin Native Format" tool.

If the file ends with .xml, the parser will read all issue nodes in the report root node:
<report>
<issue>
<type>TxtChecker</type>
<fileName>/tmp/file.txt</fileName>
<lineStart>5</lineStart>
<severity>ERROR</severity>
<message>Token 'aaa' is not expected here</message>
</issue>
<issue>
<type>TxtChecker</type>
<fileName>/tmp/file.txt</fileName>
<lineStart>6</lineStart>
<severity>ERROR</severity>
<message>Token 'bbb' is not expected here</message>
</issue>
</report>
If the file ends with .json, a JSON array named issues is expected by the parser:
{
"issues": [
{
"type": "TxtChecker",
"fileName": "/tmp/file.txt",
"lineStart": "5",
"severity": "ERROR",
"message": "Token 'aaa' is not expected here"
},
{
"type": "TxtChecker",
"fileName": "/tmp/file.txt",
"lineStart": "6",
"severity": "ERROR",
"message": "Token 'bbb' is not expected here"
}
]
}
A third solution is to have each issue serialised as JSON object on each text line. This is interesting if you are creating a tool that gets a stream of issues and does not know when this will end. In this case this tool can convert the single issues to one-liner JSON and append them to a text file.
{"fileName":"file.txt","lineStart":"5","severity":"ERROR","message":"Token 'aaa' is wrong"}
{"fileName":"file.txt","lineStart":"6","severity":"ERROR","message":"Token 'bbb' is wrong"}
This project is about having the model classes that can be serialised as presented here, without any additional dependencies.
Source Code
As for any grade based project, the source code is available in the src/ folder of each module.
Build
This project is using gradle.
Command to build the sources locally:
./gradlew build
Command to deploy to your local maven repository:
./gradlew publishToMavenLocal
Command to build the documentation page:
./gradlew asciidoctor
The output of this command is an HTML page located at <git repo root>/build/docs/html5/index.html.
For project maintainers
signing.gnupg.keyName and signing.gnupg.passphrase are expected to be set in your local gradle.properties file to be able to sign.
sonatypeUser and sonatypePassword are expected to be set in order to be able to publish to a distant repository.
Command to build and publish the result to maven central:
./gradlew publishToNexus
Command to upload the documentation page on GitHub pages:
./gradlew gitPublishPush
Command to perform a release:
./gradlew release -Prelease.useAutomaticVersion=true
Using ssh-agent
Some tasks requires pushing into the distant git repository (release task or updating the gh-pages branch).
If they are failing with errors like this:
org.eclipse.jgit.api.errors.TransportException: ... Permission denied (publickey).
Then ssh-agent can be used.
eval `ssh-agent -s` ssh-add ~/.ssh/id_rsa
(source for this approach)
Get in touch
Use the Issue Model issue tracker on GitHub.
You can also contact me on Twitter: @j2r2b