{"id":20758286,"url":"https://github.com/chkal/gitlab-code-quality-plugin","last_synced_at":"2025-04-29T23:58:49.701Z","repository":{"id":224774103,"uuid":"613298178","full_name":"chkal/gitlab-code-quality-plugin","owner":"chkal","description":"Maven plugin to transform SpotBugs and Checkstyle XML reports to GitLab's JSON report format","archived":false,"fork":false,"pushed_at":"2024-11-09T13:15:23.000Z","size":104,"stargazers_count":14,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-29T23:58:43.469Z","etag":null,"topics":["checkstyle-maven","gitlab-ci","java","maven","maven-plugins","spotbugs-maven-plugin"],"latest_commit_sha":null,"homepage":"https://github.com/chkal/gitlab-code-quality-plugin","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chkal.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-13T09:51:35.000Z","updated_at":"2025-04-18T13:34:36.000Z","dependencies_parsed_at":"2024-03-02T12:51:02.982Z","dependency_job_id":null,"html_url":"https://github.com/chkal/gitlab-code-quality-plugin","commit_stats":null,"previous_names":["chkal/gitlab-code-quality-plugin"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkal%2Fgitlab-code-quality-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkal%2Fgitlab-code-quality-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkal%2Fgitlab-code-quality-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chkal%2Fgitlab-code-quality-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chkal","download_url":"https://codeload.github.com/chkal/gitlab-code-quality-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251602814,"owners_count":21615963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checkstyle-maven","gitlab-ci","java","maven","maven-plugins","spotbugs-maven-plugin"],"created_at":"2024-11-17T09:50:01.332Z","updated_at":"2025-04-29T23:58:49.682Z","avatar_url":"https://github.com/chkal.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= gitlab-code-quality-plugin\n:version_stable: 1.1.0\n:version_snapshot: 1.2.0-SNAPSHOT\n\nThis Maven plugin allows you to transform XML reports created by code quality tools like\nhttps://spotbugs.github.io/[SpotBugs] and https://checkstyle.org/[Checkstyle]\ninto a JSON format supported by https://about.gitlab.com/[GitLab] to displayed\nidentified issues in the merge request widget.\n\nimage::.readme/gitlab-merge-request-widget.png[]\n\n== Usage\n\n=== Step 1: Set up SpotBugs and/or Checkstyle\n\nAs this plugin processes XML reports of other code quality tools, you have to set up\nthe Maven plugins for SpotBugs and/or Checkstyle first.\n\nSuch a setup could look like this:\n\n[source,xml,subs=\"+attributes\"]\n----\n\u003cproject\u003e\n  \u003cbuild\u003e\n    \u003cplugins\u003e\n\n      \u003c!-- SpotBugs --\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003ecom.github.spotbugs\u003c/groupId\u003e\n        \u003cartifactId\u003espotbugs-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e4.7.3.3\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003everify\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003espotbugs\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n\n      \u003c!-- Checkstyle --\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n        \u003cartifactId\u003emaven-checkstyle-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e3.2.1\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003everify\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003echeckstyle\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n        \u003cconfiguration\u003e\n          \u003cconfigLocation\u003e\n            https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml\n          \u003c/configLocation\u003e\n          \u003clinkXRef\u003efalse\u003c/linkXRef\u003e\n        \u003c/configuration\u003e\n        \u003cdependencies\u003e\n          \u003cdependency\u003e\n            \u003cgroupId\u003ecom.puppycrawl.tools\u003c/groupId\u003e\n            \u003cartifactId\u003echeckstyle\u003c/artifactId\u003e\n            \u003cversion\u003e10.9.3\u003c/version\u003e\n          \u003c/dependency\u003e\n        \u003c/dependencies\u003e\n      \u003c/plugin\u003e\n\n    \u003c/plugins\u003e\n  \u003c/build\u003e\n\u003c/project\u003e\n----\n\n=== Step 2: Add the plugin to your pom.xml\n\nNow add the following plugin definition to your `pom.xml`:\n\n[source,xml,subs=\"+attributes\"]\n----\n\u003cproject\u003e\n  \u003cbuild\u003e\n    \u003cplugins\u003e\n\n      \u003c!-- ====================================================== --\u003e\n      \u003c!--  maven-checkstyle-plugin, spotbugs-maven-plugin, etc.  --\u003e\n      \u003c!-- ====================================================== --\u003e\n\n      \u003cplugin\u003e\n        \u003cgroupId\u003ede.chkal.maven\u003c/groupId\u003e\n        \u003cartifactId\u003egitlab-code-quality-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e{version_stable}\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cphase\u003everify\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003egenerate\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n\n    \u003c/plugins\u003e\n  \u003c/build\u003e\n\u003c/project\u003e\n----\n\nWithout any explicit configuration, the plugin will look for XML reports in the following locations:\n\n* `target/spotbugsXml.xml`\n* `target/checkstyle-result.xml`\n\nIf corresponding XML files are found and contain at least one issue, the plugin will\ngenerate the following JSON file:\n\n* `target/gl-code-quality-report.json`\n\n=== Step 3: Add the plugin to your pom.xml\n\nFinally, you will have to tell GitLab about generated JSON file by modifying your `.gitlab-ci.yml` file like this:\n\n[source,yaml]\n----\nbuild:\n  stage: build\n  image: ...\n  script:\n    - ...\n  artifacts:\n    reports:\n      codequality:\n        - target/gl-code-quality-report.json\n----\n\nWith these changes, GitLab will show all findings in the merge request widget.\n\n== Advanced configuration\n\nIn most cases, no explicit configuration of the plugin is required.\nBut depending on your needs, fine-tuning the configuration may be valuable.\n\nThe following example shows all available configuration parameters with their\ndefault values:\n\n[source,xml,subs=\"+attributes\"]\n----\n\u003cproject\u003e\n\n  \u003cbuild\u003e\n    \u003cplugins\u003e\n\n      \u003c!-- ====================================================== --\u003e\n      \u003c!--  maven-checkstyle-plugin, spotbugs-maven-plugin, etc.  --\u003e\n      \u003c!-- ====================================================== --\u003e\n\n      \u003cplugin\u003e\n        \u003cgroupId\u003ede.chkal.maven\u003c/groupId\u003e\n        \u003cartifactId\u003egitlab-code-quality-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e{version_stable}\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003egenerate\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n        \u003cconfiguration\u003e\n\n          \u003c!-- Whether to enable support for SpotBugs --\u003e\n          \u003cspotbugsEnabled\u003etrue\u003c/spotbugsEnabled\u003e\n\n          \u003c!-- Location of the SpotBugs XML report --\u003e\n          \u003cspotbugsInputFile\u003e${project.build.directory}/spotbugsXml.xml\u003c/spotbugsInputFile\u003e\n\n          \u003c!-- Whether to enable support for Checkstyle --\u003e\n          \u003ccheckstyleEnabled\u003etrue\u003c/checkstyleEnabled\u003e\n\n          \u003c!-- Location of the Checkstyle XML report --\u003e\n          \u003ccheckstyleInputFile\u003e${project.build.directory}/checkstyle-result.xml\u003c/checkstyleInputFile\u003e\n\n          \u003c!-- Location of the JSON output file --\u003e\n          \u003coutputFile\u003e${project.build.directory}/gl-code-quality-report.json\u003c/outputFile\u003e\n\n        \u003c/configuration\u003e\n      \u003c/plugin\u003e\n\n    \u003c/plugins\u003e\n  \u003c/build\u003e\n\u003c/project\u003e\n----\n\n== Multi-module configuration\n\nIf you want to use this plugin in a Maven multi-module project, you can simply add the plugin\nto one of the parent POMs which ensures that the plugin is invoked for all reactor modules.\nThis will create one JSON output file for each module.\n\nUnfortunately, GitLab only supports a single code quality JSON file per job\n(see https://gitlab.com/gitlab-org/gitlab/-/issues/9014[this issues] for details).\nTo work around this limitation, you can use https://stedolan.github.io/jq/[jq] in your\npipeline to merge all JSON reports into a single one and use this instead.\n\nSee the following pipeline definition for an example:\n\n[source,yaml]\n----\nbuild:\n  stage: build\n  image: ...\n  before_script:\n    - apt-get update \u0026\u0026 apt-get install -y jq\n  script:\n    - ...\n  after_script:\n    - find . -name gl-code-quality-report.json -print | xargs cat | jq -s \"add\" \u003e merged-gl-code-quality-report.json\n  artifacts:\n    reports:\n      codequality:\n        - merged-gl-code-quality-report.json\n----\n\n== CLI usage\n\nThe plugin may also be used and configured using the Maven CLI. Available configuration properties are:\n\n* `glcqp.spotbugsEnabled`\n* `glcqp.spotbugsInputFile`\n* `glcqp.checkstyleEnabled`\n* `glcqp.checkstyeInputFile`\n* `glcqp.outputFile`\n\nThey are used like this:\n\n[source,shell,subs=\"+attributes\"]\n----\nmvn de.chkal.maven:gitlab-code-quality-plugin:{version_stable}:check \\\n    -Dglcqp.spotbugsEnabled=true \\\n    -Dglcqp.spotbugsInputFile=target/spotbugsXml.xml \\\n    -Dglcqp.checkstyleEnabled=true \\\n    -Dglcqp.checkstyeInputFile=target/checkstyle-result.xml \\\n    -Dglcqp.outputFile=target/gl-code-quality-report.json\n----\n\n== Using the latest snapshots\n\nThe latest snapshots of this plugin are deployed to the Sonatype OSSRH repository.\nTo use these latest snapshots, you will have to modify your `pom.xml` like this:\n\n[source,xml,subs=\"+attributes\"]\n----\n\u003cproject\u003e\n\n  \u003cbuild\u003e\n    \u003cplugins\u003e\n\n      \u003c!-- ====================================================== --\u003e\n      \u003c!--  maven-checkstyle-plugin, spotbugs-maven-plugin, etc.  --\u003e\n      \u003c!-- ====================================================== --\u003e\n\n      \u003cplugin\u003e\n        \u003cgroupId\u003ede.chkal.maven\u003c/groupId\u003e\n        \u003cartifactId\u003egitlab-code-quality-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e{version_snapshot}\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003egenerate\u003c/goal\u003e\n            \u003c/goals\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n\n    \u003c/plugins\u003e\n  \u003c/build\u003e\n\n  \u003c!-- Sonatype snapshots for plugins --\u003e\n  \u003cpluginRepositories\u003e\n    \u003cpluginRepository\u003e\n      \u003cid\u003esonatype-ossrh-snapshots\u003c/id\u003e\n      \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n    \u003c/pluginRepository\u003e\n  \u003c/pluginRepositories\u003e\n\n\u003c/project\u003e\n----","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchkal%2Fgitlab-code-quality-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchkal%2Fgitlab-code-quality-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchkal%2Fgitlab-code-quality-plugin/lists"}