{"id":18258775,"url":"https://github.com/manoelcampos/javadoc-coverage","last_synced_at":"2025-04-04T19:32:03.084Z","repository":{"id":55087053,"uuid":"89024590","full_name":"manoelcampos/javadoc-coverage","owner":"manoelcampos","description":"A Doclet to generate JavaDoc coverage reports ☕️🧪📗","archived":false,"fork":false,"pushed_at":"2021-06-20T00:22:52.000Z","size":312,"stargazers_count":26,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-20T17:14:05.919Z","etag":null,"topics":["coverage","coverage-report","documentation-coverage","gradle","java","javadoc","javadoc-coverage","maven","software-quality"],"latest_commit_sha":null,"homepage":"https://manoelcampos.github.io/javadoc-coverage/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manoelcampos.png","metadata":{"files":{"readme":"README.md","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}},"created_at":"2017-04-21T21:21:47.000Z","updated_at":"2024-05-22T21:42:29.000Z","dependencies_parsed_at":"2022-08-14T11:31:24.468Z","dependency_job_id":null,"html_url":"https://github.com/manoelcampos/javadoc-coverage","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manoelcampos%2Fjavadoc-coverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manoelcampos%2Fjavadoc-coverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manoelcampos%2Fjavadoc-coverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manoelcampos%2Fjavadoc-coverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manoelcampos","download_url":"https://codeload.github.com/manoelcampos/javadoc-coverage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247237682,"owners_count":20906330,"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":["coverage","coverage-report","documentation-coverage","gradle","java","javadoc","javadoc-coverage","maven","software-quality"],"created_at":"2024-11-05T10:34:35.106Z","updated_at":"2025-04-04T19:31:58.073Z","avatar_url":"https://github.com/manoelcampos.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaDoc Coverage Doclet \n[![Build Status](https://github.com/manoelcampos/javadoc-coverage/actions/workflows/maven.yml/badge.svg)](https://github.com/manoelcampos/javadoc-coverage/actions/workflows/maven.yml) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/0fef8ada2def4d239931f90a50a3f778)](https://www.codacy.com/app/manoelcampos/javadoc-coverage?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=manoelcampos/javadoc-coverage\u0026amp;utm_campaign=Badge_Grade) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.manoelcampos/javadoc-coverage/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.manoelcampos/javadoc-coverage) [![GPL licensed](https://img.shields.io/badge/license-GPL-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)\n\n![](coverage-report-sample.png)\n\nThe Doclet parses java source files and checks the percentage of the Java code covered by JavaDoc documentation, including:\n- packages (*Java 9 modules not supported yet*)\n- classes, inner classes, interfaces and enums\n- class attributes\n- methods, parameters, exceptions and return value.\n\nA sample coverage report is available [here](https://manoelcampos.com/javadoc-coverage/sample-project/target/site/apidocs/javadoc-coverage.html).\n\nCurrent IDEs warn about missing JavaDoc tags and documentation, allowing you to individually fix the issues, but you don't get a big the picture. \nSimilar to code coverage tools, this plugin provides a way to get a summarized overview of your project's documentation coverage.\nIt provides a [Doclet](http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/doclet/overview.html) to be used with the JavaDoc Tool to show JavaDoc documentation coverage of your project.\n\n# Usage\n\nThe easier ways to use the plugin is through Maven or Gradle. You can use the plugin calling the JavaDoc Tool directly from the command line (but this isn't handy and it isn't explained here).\n\n## Maven: Using the CoverageDoclet in a regular way\n\nTo generate the regular JavaDoc HTML files and the coverage report, you have to include two `\u003cexecution\u003e` tags for the `maven-javadoc-plugin` inside your project's `pom.xml` file, as the exemple below:\n\n```xml\n\u003cbuild\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-javadoc-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e2.10.4\u003c/version\u003e\n            \u003cexecutions\u003e\n                \u003c!-- Exports JavaDocs to regular HTML files --\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003ejavadoc-html\u003c/id\u003e\n                    \u003cphase\u003epackage\u003c/phase\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003ejavadoc\u003c/goal\u003e\n                    \u003c/goals\u003e\n                \u003c/execution\u003e\n\n                \u003c!-- Generates the JavaDoc coverage report --\u003e\n                \u003cexecution\u003e\n                    \u003cid\u003ejavadoc-coverage\u003c/id\u003e\n                    \u003cphase\u003epackage\u003c/phase\u003e\n                    \u003cgoals\u003e\n                        \u003cgoal\u003ejavadoc\u003c/goal\u003e\n                    \u003c/goals\u003e\n                    \u003cconfiguration\u003e\n                        \u003cdoclet\u003ecom.manoelcampos.javadoc.coverage.CoverageDoclet\u003c/doclet\u003e\n                        \u003cdocletArtifact\u003e\n                            \u003cgroupId\u003ecom.manoelcampos\u003c/groupId\u003e\n                            \u003cartifactId\u003ejavadoc-coverage\u003c/artifactId\u003e\n                            \u003cversion\u003e1.1.0\u003c/version\u003e\n                        \u003c/docletArtifact\u003e\n                    \u003c/configuration\u003e\n                \u003c/execution\u003e\n            \u003c/executions\u003e\n        \u003c/plugin\u003e\n    \u003cplugins\u003e\n\u003cbuild\u003e\n```\n\nNow, to generate the regular JavaDocs in HTML and the documentation coverage report, you can execute the `package` goal in Maven, using your IDE or the command line inside your project's root directory:\n\n```bash\nmvn clean package\n```\n\nThe JavaDoc coverage report is generated by default as `javadoc-coverage.html` at `target/site/apidocs/`.\n\nThere is a [sample project](sample-project) where you can test the plugin. Just execute the command above inside the project's directory to see the results.\n\n## Maven: Using the CoverageDoclet with the maven-site-plugin\nIf you are generating a maven site and want to include the regular JavaDocs HTML and the JavaDoc Coverage Report into the \"Reports\" section of the site, the `maven-javadoc-plugin` must be included with slightly different configurations into the `\u003creporting\u003e` tag (instead of the `\u003cbuild\u003e` tag), as the example below:\n\n```xml\n\u003creporting\u003e\n    \u003cplugins\u003e\n        \u003cplugin\u003e\n            \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n            \u003cartifactId\u003emaven-javadoc-plugin\u003c/artifactId\u003e\n            \u003cversion\u003e2.10.4\u003c/version\u003e\n            \u003creportSets\u003e\n                \u003creportSet\u003e\n                    \u003c!-- Exports JavaDocs to regular HTML files --\u003e\n                    \u003cid\u003ejavadoc-html\u003c/id\u003e\n                    \u003creports\u003e\n                        \u003creport\u003ejavadoc\u003c/report\u003e\n                    \u003c/reports\u003e\n                \u003c/reportSet\u003e\n\n                \u003creportSet\u003e\n                    \u003c!-- Generates the JavaDoc coverage report --\u003e\n                    \u003cid\u003ejavadoc-coverage\u003c/id\u003e\n                    \u003creports\u003e\n                        \u003creport\u003ejavadoc\u003c/report\u003e\n                    \u003c/reports\u003e\n                    \u003cconfiguration\u003e\n                        \u003cname\u003eJavaDoc Coverage\u003c/name\u003e\n                        \u003cdescription\u003ePercentage of the code coverage by JavaDoc documentation.\u003c/description\u003e\n                        \u003cdoclet\u003ecom.manoelcampos.javadoc.coverage.CoverageDoclet\u003c/doclet\u003e\n                        \u003cdocletArtifact\u003e\n                            \u003cgroupId\u003ecom.manoelcampos\u003c/groupId\u003e\n                            \u003cartifactId\u003ejavadoc-coverage\u003c/artifactId\u003e\n                            \u003cversion\u003e1.1.0\u003c/version\u003e\n                        \u003c/docletArtifact\u003e\n                        \u003c!-- This is the same as using -d into the additionalparam tag --\u003e\n                        \u003cdestDir\u003ejavadoc-coverage\u003c/destDir\u003e\n                        \u003c!-- You can also use -o instead of -outputName to define\n                        the name of the generated report. --\u003e\n                        \u003cadditionalparam\u003e-outputName \"index.html\"\u003c/additionalparam\u003e\n                    \u003c/configuration\u003e\n                \u003c/reportSet\u003e\n            \u003c/reportSets\u003e\n        \u003c/plugin\u003e\n    \u003c/plugins\u003e\n\u003c/reporting\u003e\n```\n\nNotice that in this case, the coverage report is being generated into the `target/site/javadoc-coverage` (as defined by the `destDir` tag) with the name of `index.html` (as defined by the `\u003cadditionalparam\u003e` tag), as required for the maven site. More details of additional parameters is provided in the next section.\n\nNow, to generate the site you can execute:\n\n```bash\nmvn clean site\n```\n\nThe list of project's reports will be included into the `target/site/project-reports.html` file.\n\n## Gradle\n\nTo use the Doclet with Gradle, add the following code to your `build.gradle` file.\n\n```gradle\nconfigurations {\n// Other configuration lines might be in here\n    javadocCoverage\n}\ndependencies {\n// Your application's other dependencies go here.\n    javadocCoverage \"com.manoelcampos:javadoc-coverage:1.1.0\"\n}\n// This generates the Javadoc coverage report into build/reports/javadoc/javadoc-coverage.html\ntask javadocCoverageReport(type: Javadoc, dependsOn: javadoc) {\n    source = sourceSets.main.allJava\n    destinationDir = reporting.file(\"javadoc\")\n    options.docletpath = configurations.javadocCoverage.files.asType(List)\n    options.doclet = \"com.manoelcampos.javadoc.coverage.CoverageDoclet\"\n}\n// Optionally you can add the dependsOn here so that when you generate the javadoc\n// jar, e.g. if you include the javadocJar in a publishing configuration, the javadoc\n// coverage report will be generated automatically.\ntask javadocJar(type: Jar, dependsOn: javadocCoverageReport) {\n    classifier \"javadoc\"\n    from javadoc.destinationDir\n}\n```\n\n# Additional Configuration (optional)\n\nYou can define additional configurations for the plugin. \nThe examples below are presented only for Maven (but the same parameters work for Gradle).\n\n## Changing the name of the coverage report file\nThe CoverageDoclet accepts the command line parameter `-outputName` (`-o` for short) to set the name of the report. The following example shows the code to be added to the `\u003cconfiguration\u003e` tag of the `maven-javadoc-plugin`:\n```xml\n\u003cadditionalparam\u003e-outputName \"my-project-javadoc-coverage-report.html\"\u003c/additionalparam\u003e\n```\n\n## Excluding packages from the coverage report\nYou can exclude some packages from the coverage report by adding the code example below into the `\u003cconfiguration\u003e` tag of the `maven-javadoc-plugin`.\n\n```xml\n\u003cconfiguration\u003e\n    \u003cdoclet\u003ecom.manoelcampos.javadoc.coverage.CoverageDoclet\u003c/doclet\u003e\n    \u003cdocletArtifact\u003e\n        \u003cgroupId\u003ecom.manoelcampos\u003c/groupId\u003e\n        \u003cartifactId\u003ejavadoc-coverage\u003c/artifactId\u003e\n        \u003cversion\u003e1.1.0\u003c/version\u003e\n    \u003c/docletArtifact\u003e\n    \u003c!-- Excludes packages from the coverage report. --\u003e\n    \u003cexcludePackageNames\u003ecom.manoelcampos.sample2\u003c/excludePackageNames\u003e\n\u003c/configuration\u003e\n```\n\nThe example shows how to ignore the package `com.manoelcampos.sample2` from the coverage report. The `\u003cexcludePackageNames\u003e` tag accepts a list of packages separated by `:` and also wildcards such as `*`.\nFor more details, check this [link](https://maven.apache.org/plugins/maven-javadoc-plugin/examples/exclude-package-names.html).\n\nIf you are generating the regular JavaDoc HTML files, you have to include this configuration only where the CoverageDoclet is being used into your pom.xml, unless you want these packages to be excluded from the regular JavaDocs too.\n\n# Building the Doclet from Sources\n\nThe Doclet is a Java Maven project which can be built directly from any IDE or using the following maven command:\n\n```bash\nmvn clean install\n```\n\nThe command builds the Doclet and install it at your local maven repository.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanoelcampos%2Fjavadoc-coverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanoelcampos%2Fjavadoc-coverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanoelcampos%2Fjavadoc-coverage/lists"}