make gradle dependency task to exclude test dependencies in its result

Bharat

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?

Bjørn Vester

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]

編集
0

コメントを追加

0

関連記事

分類Dev

Gradle dependencies exclude

分類Dev

Visualize gradle task dependencies

分類Dev

How to exclude transitive jar dependency in Gradle?

分類Dev

Cannot exclude directories for a Gradle copy task

分類Dev

Add provided dependency to test classpath using Gradle

分類Dev

Run gradle build(test) in subprojects in a custom task

分類Dev

Use a Task to avoid multiple calls to expensive operation and to cache its result

分類Dev

Gradle Spring Cloud Stream project does not build because of test dependency

分類Dev

In gradle, should I exclude all dependencies under a branch or just the root is enough?

分類Dev

How to build jacoco test report task in Kotlin (Gradle 5)

分類Dev

How to include a dependency to parent test classes for a submodule in a Gradle multiple project build?

分類Dev

DRY gradle dependency blocks

分類Dev

Gradle subproject build dependency

分類Dev

Gradle duplicate classes in dependencies

分類Dev

Visualizing gradle dependencies in Intellij

分類Dev

How do I show a list of all the test failures after completion of a gradle task involving tests

分類Dev

PHPUnit test dependencies

分類Dev

Gradle Heroku Task 'stage'

分類Dev

Modify an existing gradle task

分類Dev

Modify an existing gradle task

分類Dev

Reinstall package and its installed dependencies

分類Dev

Gradle not imported dependency with ext:pom

分類Dev

NanoHTTPD - unable to add gradle dependency

分類Dev

Fix dependency resolution errors in Gradle

分類Dev

Gradle not downloading dependencies in intelliJ idea

分類Dev

Gradle does not update snapshot dependencies

分類Dev

Gradle. Detect dependencies problems

分類Dev

Exclude test files from Pylint

分類Dev

dependencies.dependency.version 'is missing error

Related 関連記事

  1. 1

    Gradle dependencies exclude

  2. 2

    Visualize gradle task dependencies

  3. 3

    How to exclude transitive jar dependency in Gradle?

  4. 4

    Cannot exclude directories for a Gradle copy task

  5. 5

    Add provided dependency to test classpath using Gradle

  6. 6

    Run gradle build(test) in subprojects in a custom task

  7. 7

    Use a Task to avoid multiple calls to expensive operation and to cache its result

  8. 8

    Gradle Spring Cloud Stream project does not build because of test dependency

  9. 9

    In gradle, should I exclude all dependencies under a branch or just the root is enough?

  10. 10

    How to build jacoco test report task in Kotlin (Gradle 5)

  11. 11

    How to include a dependency to parent test classes for a submodule in a Gradle multiple project build?

  12. 12

    DRY gradle dependency blocks

  13. 13

    Gradle subproject build dependency

  14. 14

    Gradle duplicate classes in dependencies

  15. 15

    Visualizing gradle dependencies in Intellij

  16. 16

    How do I show a list of all the test failures after completion of a gradle task involving tests

  17. 17

    PHPUnit test dependencies

  18. 18

    Gradle Heroku Task 'stage'

  19. 19

    Modify an existing gradle task

  20. 20

    Modify an existing gradle task

  21. 21

    Reinstall package and its installed dependencies

  22. 22

    Gradle not imported dependency with ext:pom

  23. 23

    NanoHTTPD - unable to add gradle dependency

  24. 24

    Fix dependency resolution errors in Gradle

  25. 25

    Gradle not downloading dependencies in intelliJ idea

  26. 26

    Gradle does not update snapshot dependencies

  27. 27

    Gradle. Detect dependencies problems

  28. 28

    Exclude test files from Pylint

  29. 29

    dependencies.dependency.version 'is missing error

ホットタグ

アーカイブ