dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
No console or JSON output from `buildHealth`
Plugin version 1.28.0
Gradle version 8.2
JDK version OpenJDK 19
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version Kotlin 1.8.20
(Optional) Android Gradle Plugin (AGP) version AGP 8.2.1
Describe the bug I'm probably missing something but the wiki clearly states:
The plugin enables these use-cases through the concept of "advice". When you execute the buildHealth task, it analyzes your entire project, including all variants for Android projects, and does two things:
- Prints that advice to the console in an easy-to-read format.
- Prints that advice to disk as JSON for advanced users who want to automate post-processing the results.
When I execute the buildHealth
I do not get any console output. Neither do I get a json file.
To Reproduce Steps to reproduce the behavior:
- add
id 'com.autonomousapps.dependency-analysis' version '1.28.0'
to theplugins
section of the project-widebuild.gradle
- Add the following configuration at the top-level of the project-wide
build.gradle
:
dependencyAnalysis {
issues {
all {
onAny {
severity('fail')
}
}
}
}
Expected behavior
- Prints [...] advice to the console in an easy-to-read format.
- Prints [...] advice to disk as JSON for advanced users who want to automate post-processing the results.
Additional context
$ ./gradlew buildHealth
> Configure project :
The Dependency Analysis plugin is only known to work with versions of AGP between 7.4.2 and 8.2.0-alpha16. You are using 8.2.1. Proceed at your own risk.
> Configure project :app
Android Gradle Plugin version 8.2.1
Using register source type API
Not using sources add API
applied
> Task :buildHealth FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':buildHealth'.
> There were dependency violations. See report at file:///[REDACTED]/build/reports/dependency-analysis/build-health-report.txt
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 5s
1419 actionable tasks: 11 executed, 1408 up-to-date
Is there no file at
> There were dependency violations. See report at file:///[REDACTED]/build/reports/dependency-analysis/build-health-report.txt
?
The file:///[REDACTED]/build/reports/dependency-analysis/build-health-report.txt
file does exist but it is not printed to stdout, neither is it in json format.
There is a file build-health-report.json
that is machine readable. The console report can be auto-printed by setting the flag
# gradle.properties
dependency.analysis.print.build.health=true
Indeed, next to build-health-report.txt
there was a build-health-report.json
. Setting dependency.analysis.print.build.health=true
in the project-wide gradle.properties also caused the expected printout. Thank you!
I think the dependency.analysis.print.build.health=true
requirement should be more obviously documented as current documentation makes it sound like the stdout print should happen by default.
Perhaps by updating the wiki like this?
The plugin enables these use-cases through the concept of "advice". When you execute the buildHealth task, it analyzes your entire project, including all variants for Android projects, and does two things:
- Prints that advice to disk in an easy-to-read format (
build/reports/dependency-analysis/build-health-report.txt
).- Prints that advice to disk as JSON for advanced users who want to automate post-processing the results (
build/reports/dependency-analysis/build-health-report.json
).You can also print the easy-to-read advice to stdout by setting
dependency.analysis.print.build.health=true
in your project-widegradle.properties
.
I've decided I'll just update the readme. Thanks for the report!