【发布时间】:2020-05-21 06:32:11
【问题描述】:
我已经对“gradle classpath site:stackoverflow.com”和“gradle classpath”进行了网络搜索,并且仅在以下位置找到了相关信息:
Gradle: What is the difference between classpath and compile dependencies?
余腾宝的回答是这样写的:
compile 'org.hibernate:hibernate-core:5.0.5.Final' 是一个模块 依赖声明。编译配置(现在是 被实现配置弃用。)只是一个关键字 仅用于实现依赖项。不是关键字描述 它是哪种类型的依赖项(按类型在这里我遵循三个 教程中定义的类型,即模块、文件和项目。)
据我了解,classpath 也是关键字。我试图在 gradle docs 中找到它的含义:
https://docs.gradle.org/current/userguide/declaring_dependencies.html
以及其中引用的其他一些内容:
https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html
https://docs.gradle.org/current/userguide/java_library_plugin.html
https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html
https://docs.gradle.org/current/userguide/variant_model.html
https://docs.gradle.org/current/userguide/java_plugin.html
还有: https://docs.gradle.org/current/javadoc/org/gradle/api/initialization/dsl/ScriptHandler.html https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/Classpath.html https://docs.gradle.org/current/userguide/organizing_gradle_projects.html
提到了“compileClasspath”。如果 classpath 关键字仅被弃用为 compile 一个,为什么文档中没有它?
附:我的意思是:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
回答后添加:
【问题讨论】: