Gradle: What is the difference between classpath and compile dependencies?

后端 未结 3 624
逝去的感伤
逝去的感伤 2021-01-30 12:11

When adding dependencies to my project I am never sure what prefix I should give them, e.g. \"classpath\" or \"compile\".

For example, should

3条回答
  •  悲哀的现实
    2021-01-30 12:42

    If buildscript itself needs something to run, use classpath.

    If your project needs something to run, use compile.

    The buildscript{} block is for the build.gradle itself.

    For multi-project building, the top-level build file is for the root project, the specific build file is for sub-project (module).

    Top-level build file where you can add configuration options common to all sub-projects/modules.

    Do not place your application dependencies in top-level build file, they belong in the individual module build.gradle files

提交回复
热议问题