{"id":13592965,"url":"https://github.com/autonomousapps/dependency-analysis-gradle-plugin","last_synced_at":"2025-05-14T06:12:23.927Z","repository":{"id":37399445,"uuid":"217134508","full_name":"autonomousapps/dependency-analysis-gradle-plugin","owner":"autonomousapps","description":"Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins","archived":false,"fork":false,"pushed_at":"2025-05-09T17:51:06.000Z","size":49796,"stargazers_count":1945,"open_issues_count":146,"forks_count":127,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-09T18:38:42.905Z","etag":null,"topics":["android","gradle-plugin","groovy","java","jvm","kotlin","scala"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/autonomousapps.png","metadata":{"files":{"readme":"README.asciidoc","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.asciidoc","funding":".github/FUNDING.yml","license":"LICENSE.txt","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":"autonomousapps"}},"created_at":"2019-10-23T19:12:37.000Z","updated_at":"2025-05-09T17:51:11.000Z","dependencies_parsed_at":"2023-10-17T03:06:28.262Z","dependency_job_id":"197ca650-09fe-4176-a7b2-0c1feed53b59","html_url":"https://github.com/autonomousapps/dependency-analysis-gradle-plugin","commit_stats":{"total_commits":1838,"total_committers":49,"mean_commits":37.51020408163265,"dds":"0.17736670293797607","last_synced_commit":"c9b15efad157e312eb7cce2902910764dbaebcc5"},"previous_names":["autonomousapps/dependency-analysis-android-gradle-plugin"],"tags_count":215,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fdependency-analysis-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fdependency-analysis-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fdependency-analysis-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autonomousapps%2Fdependency-analysis-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autonomousapps","download_url":"https://codeload.github.com/autonomousapps/dependency-analysis-gradle-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254080461,"owners_count":22011407,"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-plugin","groovy","java","jvm","kotlin","scala"],"created_at":"2024-08-01T16:01:15.165Z","updated_at":"2025-05-14T06:12:23.878Z","avatar_url":"https://github.com/autonomousapps.png","language":"Kotlin","readme":"image::https://img.shields.io/maven-metadata/v.svg?label=release\u0026metadataUrl=https%3A%2F%2Frepo1.maven.org%2Fmaven2%2Fcom%2Fautonomousapps%2Fdependency-analysis%2Fcom.autonomousapps.dependency-analysis.gradle.plugin%2Fmaven-metadata.xml[Latest version,link=\"https://mvnrepository.com/artifact/com.autonomousapps.dependency-analysis/com.autonomousapps.dependency-analysis.gradle.plugin\"]\nimage::https://img.shields.io/nexus/s/com.autonomousapps/dependency-analysis-gradle-plugin?label=snapshot\u0026server=https%3A%2F%2Foss.sonatype.org[Latest snapshot,link=\"https://oss.sonatype.org/#nexus-search;gav~com.autonomousapps.dependency-analysis~com.autonomousapps.dependency-analysis.gradle.plugin~~~~kw,versionexpand\"]\nimage::https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/workflows/Main/badge.svg[Build status,link=\"https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/actions/workflows/push.yml?query=branch%3Amain\"]\n\n== Detect unused and misused dependencies\nThe Dependency Analysis Gradle Plugin (DAGP, née Dependency Analysis Android Gradle Plugin) detects the following:\n\n1. Unused dependencies.\n2. Used transitive dependencies (which you may want to declare directly).\n3. Dependencies declared on the wrong configuration (`api` vs `implementation` vs `compileOnly`, etc.).\n\nAs a side effect, the plugin can also tell you your project's ABI, and produces graphviz files representing various\nviews of your dependency graph, among other things. These side effects are currently mostly undocumented internal\nbehaviors, but they may be interesting for some advanced users.\n\n== Build health\n\nIn addition to the dependency-related advice (see above), DAGP provides other advice to help maintain your \"build health.\" This includes the detection of:\n\n1. Unnecessary plugins (currently only `kapt`).\n2. Subprojects (\"modules\") that unnecessarily use the Android plugin, and could instead be \"normal\" JVM libraries.\n\n== Compatibilities\n\nPlease see the https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/Compatibilities-\u0026-Limitations[wiki] for information on the versions of Gradle, the Android Gradle Plugin, etc., that this plugin is compatible with.\n\n== Add to your project and use\nFor detailed instructions, see\nhttps://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/Adding-to-your-project[the wiki].\n\nThe simplest approach is to add the following:\n\n.root settings.gradle[.kts]\n[source,groovy]\n----\nplugins {\n  id(\"com.autonomousapps.build-health\") version \"\u003c\u003clatest_version\u003e\u003e\"\n}\n----\n\nIMPORTANT: If your project uses Kotlin or Android (or both), then those plugins must also be loaded in the settings\nscript classloader (or a parent). See\nhttps://github.com/autonomousapps/dependency-analysis-gradle-plugin/wiki/Adding-to-your-project[the wiki] for more information\n\nFor a quick start, just run the following:\n\n----\n./gradlew buildHealth\n----\n\nYou will probably see output like the following:\n\n----\n\u003e Task :buildHealth FAILED\n\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nExecution failed for task ':buildHealth'.\n\u003e There were dependency violations. See report at file:///path/to/project/build/reports/dependency-analysis/build-health-report.txt\n----\n\nIf you wish to have this (potentially very long) report printed to console, add this to your `gradle.properties` file:\n\n.gradle.properties\n[source]\n----\ndependency.analysis.print.build.health=true\n----\n\n== More advanced usage\n\nYou do not have to apply this plugin to all projects via the settings script. It can also be applied to only specific\nsubprojects. In this case, it must also be applied to the root build script.\n\n.root build.gradle[.kts]\n[source,groovy]\n----\nplugins {\n  id(\"com.autonomousapps.dependency-analysis\") version \"\u003c\u003clatest_version\u003e\u003e\"\n}\n----\n\n.sub/project/build.gradle[.kts]\n[source,groovy]\n----\nplugins {\n  id(\"com.autonomousapps.dependency-analysis\")\n}\n----\n\nIMPORTANT: If your project uses Kotlin or Android (or both), then those plugins must also be loaded in the root build\nscript classloader (or a parent). See\nhttps://github.com/autonomousapps/dependency-analysis-gradle-plugin/wiki/Adding-to-your-project[the wiki] for more information\n\n=== Project Health\n\nThe analysis can be run against individual modules with the `projectHealth` task. For example:\n\n----\n./gradlew app:projectHealth\n----\n\n=== Fix dependency issues automatically\n\nIt is common for the plugin to report many issues with your project's dependency declarations. Since fixing manually can\nbe tedious, the plugin also provides a task to auto-remediate all issues.\n\n----\n./gradlew fixDependencies\n----\n\nThe `fixDependencies` task is registered on each project where the plugin is applied. Running it as above will run the\ntask in each subproject. See also\nhttps://dev.to/autonomousapps/one-click-dependencies-fix-191p[_One click dependencies fix_].\n\n==== Fix only some dependency issues automatically\n\nIn some circumstances, it may be considered infeasible to resolve all issues in one pass. Maybe you have a very large\nproject, or you publish libraries and you know that changing your dependency declarations will also change your\nlibraries' metadata, which might break consumers. To support this use-case, the the `fixDependencies` task takes an\noptional flag to tell it to, essentially, make only \"safe\" changes.\n\n----\n./gradlew fixDependencies --upgrade\n----\n\nWith this flag in place, the `fixDependencies` task will not remove or \"downgrade\" any dependency declarations. It will\nonly add or \"upgrade\" declarations (e.g., from `implementation` to `api`).\n\nIn an incremental rollout scenario, one could imagine using the `--upgrade` flag, then updating all consumers, then\nfinally removing the flag and removing all unused dependencies.\n\n==== Caveats\n\nIf the analysis has any bugs, then fixing the dependency declarations make break your build (but this is also the case\nwith manual fixes). If you encounter this, please\nhttps://github.com/autonomousapps/dependency-analysis-gradle-plugin/issues/new/choose[file an issue].\n\nAdditionally, the rewriting functionality is based on a simplified Gradle Groovy/Kotlin DSL grammar, which will fail in\nthe presence of complex build scripts. We plan to enhance the Gradle Kotlin DSL grammar soon, since it is the default\nbuild script language, but we have no current plans to do the same for Gradle Groovy DSL.\n\n=== Reason\n\nYou may be curious why the plugin is emitting (or not emitting) advice regarding some dependency. You can ask it why:\n\n----\n./gradlew lib:reason --id com.squareup.okio:okio:2.2.2 \u003c1\u003e\n\u003e Task :lib:reason\n\n----------------------------------------\nYou asked about the dependency 'com.squareup.okio:okio:2.2.2'.\nThere is no advice regarding this dependency.\n----------------------------------------\n\nShortest path from :lib to com.squareup.okio:okio:2.2.2:\n:lib\n\\--- com.squareup.okio:okio:2.2.2\n\nSource: main\n------------\n* Exposes class okio.BufferedSource (implies api).\n----\n\u003c1\u003e The version string is optional.\n\n=== Basic configuration\n\nFor detailed information on how to configure the plugin, see https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/wiki/Customizing-plugin-behavior[the wiki].\n\nTo configure the plugin, use the https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/blob/main/src/main/kotlin/com/autonomousapps/DependencyAnalysisExtension.kt[`dependencyAnalysis`] extension.\n\n.build.gradle\n[source,groovy]\n----\ndependencyAnalysis {\n  // configuration goes here\n}\n----\n\n== Publications\nThe following is a list of articles / blog posts that have been published discussing this plugin:\n\n1. https://dev.to/autonomousapps/the-proper-care-and-feeding-of-your-gradle-build-d8g[The proper care and feeding of your Gradle build]\n2. https://dev.to/autonomousapps/dependency-analysis-gradle-plugin-using-bytecode-analysis-to-find-unused-dependencies-509n[Dependency Analysis Gradle Plugin: Using bytecode analysis to find unused dependencies]\n3. https://dev.to/autonomousapps/dependency-analysis-gradle-plugin-what-s-an-abi-3l2h[Dependency Analysis Gradle Plugin: What's an ABI?]\n4. https://dev.to/autonomousapps/reducing-my-gradle-plugin-s-impact-on-configuration-time-a-journey-32h2[Reducing my Gradle plugin's impact on configuration time: A journey]\n5. https://dev.to/autonomousapps/one-click-dependencies-fix-191p[One-click dependencies fix]\n\n...with more to come :)\n\nThis plugin has also been featured in these newsletters:\n\n1. https://newsletter.gradle.org/2024/10[Gradle, Oct 2024]\n2. https://newsletter.gradle.com/2022/05[Gradle, May 2022]\n3. https://newsletter.gradle.com/2020/09[Gradle, September 2020]\n4. https://newsletter.gradle.com/2020/08[Gradle, August 2020]\n5. https://androidweekly.net/issues/issue-423[Android Weekly, Issue #423]\n6. https://newsletter.gradle.com/2020/07[Gradle, July 2020]\n7. https://newsletter.gradle.com/2020/06[Gradle, June 2020]\n\nPodcast episodes about this plugin could be found here:\n\n1. https://thebakery.dev/31/[The Developers' Bakery, Episode #31]\n\nYoutube videos about this plugin:\n\n1. https://youtu.be/Lipf5piizZc[Understanding Gradle #28 – Clean Compile Classpaths with the Dependency Analysis Plugin]\n","funding_links":["https://github.com/sponsors/autonomousapps"],"categories":["Navigation","Kotlin"],"sub_categories":["Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomousapps%2Fdependency-analysis-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautonomousapps%2Fdependency-analysis-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautonomousapps%2Fdependency-analysis-gradle-plugin/lists"}