{"id":13821187,"url":"https://github.com/jaredsburrows/gradle-license-plugin","last_synced_at":"2025-05-15T13:08:59.460Z","repository":{"id":37959730,"uuid":"77008133","full_name":"jaredsburrows/gradle-license-plugin","owner":"jaredsburrows","description":"Gradle plugin that provides a task to generate a HTML license report of your project.","archived":false,"fork":false,"pushed_at":"2025-05-14T23:50:35.000Z","size":1942,"stargazers_count":421,"open_issues_count":26,"forks_count":67,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-15T00:38:04.229Z","etag":null,"topics":["android","gradle","groovy","html-report","java","json-report","license","licenses","open","open-source","report","source"],"latest_commit_sha":null,"homepage":"https://jaredsburrows.github.io/gradle-license-plugin/","language":"Groovy","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/jaredsburrows.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"jaredsburrows","patreon":"jaredsburrows","open_collective":"jaredsburrows","ko_fi":"jaredsburrows","tidelift":null,"community_bridge":null,"liberapay":"jaredsburrows","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://paypal.me/jaredsburrows","https://venmo.com/jaredsburrows","https://cash.app/$jaredburrows","https://buymeacoffee.com/jaredsburrows"]}},"created_at":"2016-12-21T02:21:13.000Z","updated_at":"2025-05-14T23:50:38.000Z","dependencies_parsed_at":"2023-02-14T08:17:31.800Z","dependency_job_id":"3101b5af-87da-4274-a38f-fbcd9520cc63","html_url":"https://github.com/jaredsburrows/gradle-license-plugin","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredsburrows%2Fgradle-license-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredsburrows%2Fgradle-license-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredsburrows%2Fgradle-license-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredsburrows%2Fgradle-license-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredsburrows","download_url":"https://codeload.github.com/jaredsburrows/gradle-license-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"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":["android","gradle","groovy","html-report","java","json-report","license","licenses","open","open-source","report","source"],"created_at":"2024-08-04T08:01:17.095Z","updated_at":"2025-05-15T13:08:54.453Z","avatar_url":"https://github.com/jaredsburrows.png","language":"Groovy","funding_links":["https://github.com/sponsors/jaredsburrows","https://patreon.com/jaredsburrows","https://opencollective.com/jaredsburrows","https://ko-fi.com/jaredsburrows","https://liberapay.com/jaredsburrows","https://paypal.me/jaredsburrows","https://venmo.com/jaredsburrows","https://cash.app/$jaredburrows","https://buymeacoffee.com/jaredsburrows"],"categories":["Groovy"],"sub_categories":[],"readme":"# Gradle License Plugin\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n[![Maven](https://img.shields.io/maven-central/v/com.jaredsburrows/gradle-license-plugin?label=maven\u0026style=flat)](https://search.maven.org/artifact/com.jaredsburrows/gradle-license-plugin)\n[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.jaredsburrows.license)](https://plugins.gradle.org/plugin/com.jaredsburrows.license)\n[![Build](https://github.com/jaredsburrows/gradle-license-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/jaredsburrows/gradle-license-plugin/actions/workflows/build.yml)\n[![Twitter Follow](https://img.shields.io/twitter/follow/jaredsburrows.svg?style=social)](https://twitter.com/jaredsburrows)\n\nThis plugin provides a task to generate a HTML license report based on the \nconfiguration. (eg. `licenseDebugReport` for all debug dependencies in an Android project).\n\nApplying this to an Android or Java project will generate the license \nfile(`open_source_licenses.html`) in the `\u003cproject\u003e/build/reports/licenses/`.\n\nAlso, for Android projects the license HTML file will be copied to `\u003cproject\u003e/src/main/assets/`.\n\n\n## Compatibility Matrix\n\n| Plugin Version | Minimum [Gradle](https://gradle.org/) Version | Minimum [AGP](https://developer.android.com/build/releases/gradle-plugin) Version |\n|---------------:|----------------------------------------------:|----------------------------------------------------------------------------------:|\n|       \u003c= 0.9.4 | \u003c= 7.0.2                                      |                                                                            3.6.4+ |\n|          0.9.5 | 7.0.2                                         |                                                                            3.6.4+ |\n|          0.9.6 | 7.1.3                                         |                                                                            3.6.4+ |\n|          0.9.7 | 7.2.2                                         |                                                                            3.6.4+ |\n|          0.9.8 | 7.2.2                                         |                                                                            3.6.4+ |\n\n## Download\n\n**Release:**\n\u003cdetails open\u003e\n  \u003csummary\u003ewith plugins { }\u003c/summary\u003e\n  \n\n```kotlin\nplugins {\n  id('com.jaredsburrows.license') version '0.9.8'\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ewith buildscript { }\u003c/summary\u003e\n  \n\n```groovy\nbuildscript {\n  repositories {\n    mavenCentral()\n    google() // For Android projects\n  }\n\n  dependencies {\n    classpath 'com.jaredsburrows:gradle-license-plugin:0.9.8'\n  }\n}\n\napply plugin: 'com.android.application' // or 'java-library'\napply plugin: 'com.jaredsburrows.license'\n```\n\u003c/details\u003e\n\nRelease versions are available in\nthe [Sonatype's release repository](https://repo1.maven.org/maven2/com/jaredsburrows/gradle-license-plugin/)\nand [here](https://central.sonatype.com/artifact/com.jaredsburrows/gradle-license-plugin).\n\n**Snapshot:**\n\u003cdetails open\u003e\n  \u003csummary\u003ewith plugins { }\u003c/summary\u003e\n\n```kotlin\nplugins {\n  id('com.jaredsburrows.license') version '0.9.9-SNAPSHOT'\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ewith buildscript { }\u003c/summary\u003e\n\n```groovy\nbuildscript {\n  repositories {\n    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }\n    google() // For Android projects\n  }\n\n  dependencies {\n    classpath 'com.jaredsburrows:gradle-license-plugin:0.9.9-SNAPSHOT'\n  }\n}\n\napply plugin: 'com.android.application' // or 'java-library'\napply plugin: 'com.jaredsburrows.license'\n```\n\u003c/details\u003e\n\nSnapshot versions are available in the [Sonatype's snapshots repository](https://oss.sonatype.org/content/repositories/snapshots/com/jaredsburrows/gradle-license-plugin/).\n\n## Tasks\n\n- **`license${variant}Report`** for Android\n- **`licenseReport`** for Java\n\nGenerates a HTML report of the all open source licenses. (eg. `licenseDebugReport` for all debug dependencies in an Android project).\n\nExample `build.gradle`:\n\n```groovy\ndependencies {\n  implementation 'com.android.support:design:26.1.0'\n  implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'\n  implementation 'wsdl4j:wsdl4j:1.5.1' // Very old library with no license info available\n}\n```\n\n## Example Outputs:\n\n\u003cdetails\u003e\n  \u003csummary\u003eCSV Example (full):\u003c/summary\u003e\n\n```csv\nproject,description,version,developers,url,year,licenses,license urls,dependency\nAndroid GIF Drawable Library,Views and Drawable for displaying animated GIFs for Android,1.2.3,Karol WrÃ³tniak,https://github.com/koral--/android-gif-drawable,null,The MIT License,http://opensource.org/licenses/MIT,pl.droidsonroids.gif:android-gif-drawable:1.2.3\ndesign,null,26.1.0,null,null,null,The Apache Software License,http://www.apache.org/licenses/LICENSE-2.0.txt,com.android.support:design:26.1.0\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eHTML Example (license descriptions are minimized):\u003c/summary\u003e\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"\u003e\n    \u003cstyle\u003ebody { font-family: sans-serif } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; word-break: break-word; display: inline-block }\u003c/style\u003e\n    \u003ctitle\u003eOpen source licenses\u003c/title\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003ch3\u003eNotice for packages:\u003c/h3\u003e\n    \u003cul\u003e\n      \u003cli\u003e\u003ca href=\"#1934118923\"\u003edesign\u003c/a\u003e\n        \u003cdl\u003e\n          \u003cdt\u003eCopyright \u0026copy; 20xx The original author or authors\u003c/dt\u003e\n          \u003cdd\u003e\u003c/dd\u003e\n        \u003c/dl\u003e\n      \u003c/li\u003e\n    \u003c/ul\u003e\n    \u003ca id=\"1934118923\"\u003e\u003c/a\u003e\n    \u003cpre\u003eapache-2.0.txt here\u003c/pre\u003e\n    \u003cbr\u003e\n    \u003chr\u003e\n    \u003cul\u003e\n      \u003cli\u003e\u003ca href=\"#1783810846\"\u003eAndroid GIF Drawable Library\u003c/a\u003e\n        \u003cdl\u003e\n          \u003cdt\u003eCopyright \u0026copy; 20xx Karol WrXXtniak\u003c/dt\u003e\n          \u003cdd\u003e\u003c/dd\u003e\n        \u003c/dl\u003e\n      \u003c/li\u003e\n    \u003c/ul\u003e\n    \u003ca id=\"1783810846\"\u003e\u003c/a\u003e\n    \u003cpre\u003eapache-2.0.txt here\u003c/pre\u003e\n    \u003cbr\u003e\n    \u003chr\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nNote, if no license information is found in the POM for a project, \"No License Found\" will be used. \nThose will be listed first.\nOther missing information is provided as default values that can be corrected from other sources.\nProjects are grouped by license name and the license text is only provided once. \nProjects with multiple licenses are grouped as if those licenses were a single combined license.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eJSON Example (full):\u003c/summary\u003e\n\n```json\n[\n  {\n    \"project\":\"Android GIF Drawable Library\",\n    \"description\":\"Views and Drawable for displaying animated GIFs for Android\",\n    \"version\":\"1.2.3\",\n    \"developers\":[\n      \"Karol Wr\\\\u00c3\\\\u00b3tniak\"\n    ],\n    \"url\":\"https://github.com/koral--/android-gif-drawable\",\n    \"year\":null,\n    \"licenses\":[\n      {\n        \"license\":\"The MIT License\",\n        \"license_url\":\"http://opensource.org/licenses/MIT\"\n      }\n    ],\n    \"dependency\":\"pl.droidsonroids.gif:android-gif-drawable:1.2.3\"\n  },\n  {\n    \"project\":\"design\",\n    \"description\":null,\n    \"version\":\"26.1.0\",\n    \"developers\":[],\n    \"url\":null,\n    \"year\":null,\n    \"licenses\":[\n      {\n        \"license\":\"The Apache Software License\",\n        \"license_url\":\"http://www.apache.org/licenses/LICENSE-2.0.txt\"\n      }\n    ],\n    \"dependency\":\"com.android.support:design:26.1.0\"\n  }\n]\n```\n\nNote, if no license information is found for a component, the `licenses` element in the JSON output will be an empty array.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eText Example (full):\u003c/summary\u003e\n\n```text\nNotice for packages\n\n\nAndroid GIF Drawable Library (1.2.3) - The MIT License\nViews and Drawable for displaying animated GIFs for Android\nhttps://github.com/koral--/android-gif-drawable\n\ndesign (26.1.0) - The Apache Software License\n```\n\u003c/details\u003e\n\n## Configuration\nThe plugin can be configured to generate specific reports and automatically copy the reports to the assets directory (Android projects only). The default behaviours are: \n- Java projects: Generate HTML, JSON and CSV reports.\n- Android projects: Generate HTML, JSON and CSV reports, and copy the HTML report to the assets directory.\n\nThe plugin can be configured to ignore licenses for certain artifact patterns. The default is that nothing is ignored.\n\nTo override the defaults, add the `licenseReport` configuration closure to the build script.\n\n```groovy\napply plugin: \"com.jaredsburrows.license\"\n\nlicenseReport {\n  // Generate reports\n  generateCsvReport = false\n  generateHtmlReport = true\n  generateJsonReport = false\n  generateTextReport = false\n\n  // Copy reports - These options are ignored for Java projects\n  copyCsvReportToAssets = false\n  copyHtmlReportToAssets = true\n  copyJsonReportToAssets = false\n  copyTextReportToAssets = false\n  useVariantSpecificAssetDirs = false\n  \n  // Ignore licenses for certain artifact patterns\n  ignoredPatterns = []\n  \n  // Show versions in the report - default is false\n  showVersions = true\n}\n```\n\nThe `copyHtmlReportToAssets` option in the above example would have no effect since the HTML report is disabled.\n\nThe `useVariantSpecificAssetDirs` allows the reports to be copied into the source set asset directory of the variant. For example, `licensePaidProductionReleaseReport` would put the reports in `src/paidProductionRelease/assets`. They are copied into `src/main/assets` by default.\n\nThe `ignoredPatterns` allows for ignoring artifact patterns. These can be partial or full patterns.\n\n```groovy\napply plugin: \"com.jaredsburrows.license\"\n\nlicenseReport {\n  ignoredPatterns = [\"com.some.group\"] // Ignores all artifacts of the given group\n  ignoredPatterns = [\"com.some.group:some.name\"] // Ignores the given artifact regardless of version\n  ignoredPatterns = [\"com.some.group:some.name:1.2.3\"] // Ignores the given artifact with the given version\n}\n```\n\n## Usage Example\n\n### Create an open source dialog\n\u003cdetails open\u003e\n  \u003csummary\u003eKotlin\u003c/summary\u003e\n  \n\n```kotlin\nimport android.annotation.SuppressLint\nimport android.app.AlertDialog\nimport android.app.Dialog\nimport android.content.DialogInterface\nimport android.os.Bundle\nimport android.webkit.WebView\nimport androidx.appcompat.app.AppCompatActivity\nimport androidx.fragment.app.DialogFragment\n\nclass OpenSourceLicensesDialog : DialogFragment() {\n\n  @SuppressLint(\"CommitTransaction\")\n  fun showLicenses(activity: AppCompatActivity) {\n    val fragmentManager = activity.supportFragmentManager\n    val fragmentTransaction = fragmentManager.beginTransaction()\n    val previousFragment = fragmentManager.findFragmentByTag(\"dialog_licenses\")\n    if (previousFragment != null) {\n      fragmentTransaction.remove(previousFragment)\n    }\n    fragmentTransaction.addToBackStack(null)\n\n    show(fragmentManager, \"dialog_licenses\")\n  }\n\n  override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {\n    val webView = WebView(requireActivity())\n    webView.loadUrl(\"file:///android_asset/open_source_licenses.html\")\n\n    return AlertDialog.Builder(requireActivity())\n      .setTitle(\"Open Source Licenses\")\n      .setView(webView)\n      .setPositiveButton(\"OK\"\n      ) { dialog: DialogInterface, _: Int -\u003e dialog.dismiss() }\n      .create()\n  }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eJava\u003c/summary\u003e\n  \n```java\nimport android.annotation.SuppressLint;\nimport android.app.Dialog;\nimport android.os.Bundle;\nimport android.webkit.WebView;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.app.AlertDialog;\nimport androidx.appcompat.app.AppCompatActivity;\nimport androidx.fragment.app.DialogFragment;\nimport androidx.fragment.app.Fragment;\nimport androidx.fragment.app.FragmentManager;\nimport androidx.fragment.app.FragmentTransaction;\n\npublic final class OpenSourceLicensesDialog extends DialogFragment {\n\n  @SuppressLint(\"CommitTransaction\")\n  public void showLicenses(AppCompatActivity activity) {\n    FragmentManager fragmentManager = activity.getSupportFragmentManager();\n    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();\n    Fragment previousFragment = fragmentManager.findFragmentByTag(\"dialog_licenses\");\n    if (previousFragment != null) {\n      fragmentTransaction.remove(previousFragment);\n    }\n    fragmentTransaction.addToBackStack(null);\n\n    show(fragmentManager, \"dialog_licenses\");\n  }\n\n  @Override\n  public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {\n    WebView webView = new WebView(requireActivity());\n    webView.loadUrl(\"file:///android_asset/open_source_licenses.html\");\n\n    return new AlertDialog.Builder(requireActivity())\n      .setTitle(\"Open Source Licenses\")\n      .setView(webView)\n      .setPositiveButton(\"OK\", (dialog, which) -\u003e dialog.dismiss())\n      .create();\n  }\n}\n```\n\u003c/details\u003e\n\n### How to use it\n\u003cdetails open\u003e\n  \u003csummary\u003eKotlin\u003c/summary\u003e\n  \n\n```kotlin\nOpenSourceLicensesDialog().showLicenses(this)\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eJava\u003c/summary\u003e\n  \n\n```java\nnew OpenSourceLicensesDialog().showLicenses(this);\n```\n\u003c/details\u003e\n\n\nSource: https://github.com/google/iosched/blob/2531cbdbe27e5795eb78bf47d27e8c1be494aad4/android/src/main/java/com/google/samples/apps/iosched/util/AboutUtils.java#L52\n\n\u003cimg src=\"https://www.bignerdranch.com/assets/img/blog/2015/07/screenshot-gmail.png\"  alt=\"License HTML\"/\u003e\n\nSource: https://www.bignerdranch.com/blog/open-source-licenses-and-android/\n\n## License\n```\nCopyright (C) 2016 Jared Burrows\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredsburrows%2Fgradle-license-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredsburrows%2Fgradle-license-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredsburrows%2Fgradle-license-plugin/lists"}