When i run ./gradlew dependencies
i get whole dependency tree including prod/main and test.
How can i get list of only production/main dependencies in result of dependencies task
Official documentation https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html suggests how to show dependencies that would be required on a specific config, say test runtime classpath in a Java project:
`gradle -q dependencies --configuration testRuntimeClasspath`
After googling, i found command gradlew dependencies --configuration compileClasspath
Will it's result contain runtime dependencies too ?
How can i get list of dependencies, excluding test dependencies in result of dependencies task?
If what you want are the "production" runtime dependencies, use --configuration runtimeClasspath
.
Configurations in Gradle are like buckets of dependencies. The ones contributed by the Java plugin are described here.
The most interesting ones are these:
compileClasspath
: The dependencies needed for compiling a project. Extends extends compile
(deprecated), compileOnly
and implementation
.runtimeClasspath
: The dependencies needed at runtime. Extends runtime
(deprecated), runtimeOnly
and implementation
.As you noticed, there are also "test" versions of the above two for compiling and running unit tests.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加