简体   繁体   English

Gradle依赖项:编译项目和编译名称有什么区别?

[英]Gradle dependencies: What's the difference between compile project and compile name?

Sample code 示例代码

dependencies {    
    compile project (':aProject')
    compile name: 'somefile'
    compile files('libs/something_local.jar')
    compile 'com.google.code.gson:gson:2.3.1'
}

My questions are 我的问题是

  1. What's the difference between compile project and compile name here? 这里compile projectcompile name什么区别?

  2. Is compile name the same as compile files ? compile namecompile files相同吗?

  3. When do you use compile directly as shown in the 5th line of code 什么时候直接使用compile ,如第5行代码所示

  4. What does compile do here? compile在这做什么? Is it compiling the files inside bracket/single quotes? 它是在编译括号/单引号内的文件吗? Can I use something like 'build' etc.? 我可以使用像'build'之类的东西吗?

Compile means, it is compiling the library in other to be used on your project 编译意味着,它正在编译其他的库以用于您的项目

compile project (':aProject') 编译项目(':aProject')

  • It compiles the module from your project 它从您的项目编译模块

compile files('libs/something_local.jar') 编译文件('libs / something_local.jar')

  • It compiles a file from your project (usually it is on lib directory) 它编译项目中的文件(通常是在lib目录下)

compile name: 'something_local' 编译名称:'something_local'

compile(name:'something_local', ext:'jar') 编译(名称:'something_local',分机:'jar')

  • It is the same as compile files, but your are indicating the directory of the file the repositories (like compiling from a remote repository but it is from local) 它与编译文件相同,但是您指示存储库的文件目录(例如从远程存储库编译,但它来自本地)

compile 'com.google.code.gson:gson:2.3.1' 编译'com.google.code.gson:gson:2.3.1'

  • It compiles the library from a maven repository, you use this instead of cloning the library project and putting it to your project. 它从maven存储库编译库,您可以使用它而不是克隆库项目并将其放入项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gradle依赖关系编译,apk项目,编译项目,提供,实现项目之间的区别 - Gradle dependencies difference between compile, apk project, compile project,provided,implementation project useLibrary的原理与build.gradle中的compile files('')的原理有什么区别? - What's the difference between principles of useLibrary and compile files('') in build.gradle? gradle依赖中的compile,testCompile和有什么区别 - what is the difference between compile, testCompile and provided in gradle dependency Gradle依赖项:按相对路径编译项目 - Gradle dependencies: compile project by relative path Android Gradle编译项目的特定风格 - Android Gradle compile project's specific flavor 编译(实现)和包含项目之间的区别 - Difference between compile(implementation) and include Project Android编译依赖项-Gradle构建 - Android Compile Dependencies - Gradle Build gradlew assemble和gradlew compile有什么区别 - What is the difference between gradlew assemble and gradlew compile 什么是 Android kapt 及其用法? 添加依赖项时Gradle中的anootation处理器和kapt有什么区别? - What is Android kapt and its usage? What's the difference between anootation processor and kapt in Gradle when adding dependencies? Gradle 3不推荐使用“编译项目”和“编译文件”? - Gradle 3 `compile project` and `compile files` deprecated?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM