Gradle构建语言手册
来源:互联网 发布:软件测试工程师工资 编辑:程序博客网 时间:2024/04/30 12:22
《Gradle构建语言参考手册》
版本V2.5
Project
Init scriptGradle
Settings scriptSettings
你可以在脚本中用这些对象的属性和方法。allprojects { }
Configures this project and each of its sub-projects.
artifacts { }
Configures the published artifacts for this project.
buildscript { }
Configures the build script classpath for this project.
configurations { }
Configures the dependency configurations for this project.
dependencies { }
Configures the dependencies for this project.
repositories { }
Configures the repositories for this project.
sourceSets { }
Configures the source sets of this project.
subprojects { }
Configures the sub-projects of this project.
publishing { }
Configures the PublishingExtension
added by the publishing plugin.
apply plugin: 'java'//以便于我们用'compile', 'testCompile' 配置依赖dependencies { //要要使用的依赖,在Repository仓库中可以找到 //group:name:version,相当于Maven中的groupId、artifactId、version compile 'commons-lang:commons-lang:2.6' testCompile 'org.mockito:mockito:1.9.0-rc1' //也可以是Map类型的notation compile group: 'com.google.code.guice', name: 'guice', version: '1.0' //声明任意文件作为依赖 compile files('hibernate.jar', 'libs/spring.jar') //把所有libs目录下的jars都放到编译目录中 compile fileTree('libs')}
高级依赖配置:
dependencies { 配置名(依赖标志){ 配置声明1 配置声明2 }}
例如:
apply plugin: 'java' //以便声明 'compile' 依赖dependencies { compile('org.hibernate:hibernate:3.1') { //万一版本冲突,3.1版本赢 force = true //排除特定的传递依赖 exclude module: 'cglib' //通过artifact name(工件名) exclude group: 'org.jmock' //通过group(组) exclude group: 'org.unwanted', module: 'iAmBuggy' //通过名和组 //是否禁用该依赖的传递依赖 transitive = false }}
外部依赖的Dependency notations(依赖标志):
configurationName "group:name:version:classifier@extension"
configurationName group: group:, name: name, version: version, classifier: classifier, ext: extension
工程依赖的依赖标志:
configurationName project(':someProject')
configurationName project(path: ':projectA', configuration: 'someOtherConfiguration')
文件依赖的依赖标志:
configurationName files('a file')
- Gradle构建语言手册
- Gradle构建之Groovy语言基础
- Gradle Build Language Reference【Gradle构建语言参考文档】
- gradle 构建
- Gradle 构建
- 【Gradle】gradle构建加速
- Gradle学习手册
- Gradle构建之Gradle构建基础
- 自动化构建工具 Gradle
- Gradle(三)构建任务
- Gradle构建Android project
- gradle构建多项目
- 学习Gradle构建Android
- gradle 构建apktool.jar
- gradle构建+proguard加密
- Gradle构建Android项目
- android gradle构建工具
- Gradle 构建android程序
- Git操作手册(上)
- [Leetocde]Lowest Common Ancestor of a Binary Search Tree
- JDBC学习笔记
- 性能超强悍 戴尔 R920服务器
- Install Theano in Linux without root authority (sodu)
- Gradle构建语言手册
- iOS开发系列--无限循环的图片浏览器
- UITextFild功能大全
- 空手道14个基本站姿
- hdu 3336 Count the string(kmp应用)
- Linux时间子系统之二:表示时间的单位和结构
- 有序链表的建立
- ACM1064:
- mysql 创建分区表注意事项,每一个唯一约束必须包含在Mysql分区表的分区键(也包括主键约束)。