配置 Gradle 的环境变量

export GRADLE_HOME=/opt/software/java/gradle-3.1

export PATH=\(PATH:\)GRADLE_HOME/bin

阿里巴巴的 Maven 仓库,可以设置为公共仓库,下载很快

方法:直接在 build.gradle 的开始配置

allprojects {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}
}

补充说明:在 Windows 操作系统上如何全局地配置共有仓库地址。

在 init.gradle 上粘贴上面的片段即可。

在 ext 统一声明构建的版本

buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
jacksonVersion = '2.8.5'
}
repositories {
// NOTE: You should declare only repositories that you need here
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}

在依赖中就可以这样使用:

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: "${jacksonVersion}"
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jacksonVersion}"
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: "${jacksonVersion}"
compile group: 'org.hashids', name: 'hashids', version: '1.0.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: "${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: "${springBootVersion}"
compile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
compile group: 'org.projectlombok', name: 'lombok', version: '1.16.14'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
compile group: 'com.google.guava', name: 'guava', version: '21.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.7'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.41'
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.29'
compile group: 'com.alibaba', name: 'druid', version: '1.0.18'
}

常用的依赖

compile group: 'org.springframework.data', name: 'spring-data-redis', version: '1.8.1.RELEASE'
compile group: 'redis.clients', name: 'jedis', version: '2.9.0'
compile group: 'org.springframework.session', name: 'spring-session', version: '1.3.0.RELEASE' compile group: 'org.springframework.session', name: 'spring-session-data-redis', version: '1.3.0.RELEASE'
compile group: 'org.springframework', name: 'spring-web', version: '4.3.7.RELEASE'
compile group: 'org.springframework', name: 'spring-webmvc', version: '4.3.7.RELEASE'
compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
compile group: 'javax.servlet.jsp', name: 'javax.servlet.jsp-api', version: '2.3.2-b02' compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.7'

Gradle 学习笔记的更多相关文章

  1. gradle学习笔记

    一直想着花时间学习下gradle,今天有空.入门一下.参考:极客学院gradle使用指南,官方文档:gradle-2.12/docs/userguide/installation.html,以及百度阅 ...

  2. Gradle学习笔记之Groovy

    [TOC] Gradle 的核心功能是由Java实现. 在这些功能之上, 有一个使用动态编程语言Groovy编写的领域特定语言(DSL). Gradle的构建脚本build.gradle和settin ...

  3. Android Gradle 学习笔记(五):Gradle 任务 Task

    在之前的学习中,我们了解到Gradle的构建工作都是由Task组合完成的.本节我们就来介绍一下 Task - 任务. 一.多种方式创建任务 在Gradle中,我们可以有很多种方式来创建任务.为什么有这 ...

  4. Android Gradle 学习笔记(四):Gradle 构建脚本

    本节我们从整体的角度来介绍一下Gradle. 一.setting.gradle 在Gradle中,定义了一个设置文件,用于初始化以及工程树的配置.设置文件的默认的名字就是setting.gradle, ...

  5. gradle学习笔记(1)

    1. 安装     (1) 下载最新gradle压缩包,解压到某处.地址是:Gradle web site:     (2) 添加环境变量:             1) 变量名:GRADLE_HOM ...

  6. Android Gradle 学习笔记(一):Gradle 入门

    官网地址:https://gradle.org/. 一.配置 Gradle 环境 安装Gradle之前必须要配置好Java环境,要求JDK 6 以上,并且在环境变量配置好JAVA_HOME.查看Jav ...

  7. Gradle学习笔记(1)创建简单的Java项目

      Gradle是一个基于Apache Ant和Apache Maven概念的项目自动化构建工具.它使用一种基于Groovy的特定领域语言(DSL)来声明项目设置,抛弃了基于XML的各种繁琐配置.当前 ...

  8. Android Gradle 学习笔记(六):Gradle 插件

    Gradle 本身提供了一些基本的概念和整体核心的框架,其他用于描述真实使用场景的都可以通过插件扩展的方式来实现.这样就可以通过抽象的方式提供一个核心的框架,其他具体的功能和业务都通过插件扩展的方式来 ...

  9. Android Gradle 学习笔记(七):Android Gradle 插件

    我们知道Android Gradle其实就是一个Gradle的一个第三方插件,它是由Google的Android团队开发的,基于Gradle构建的,和Android Studio完美搭配.相比于旧的构 ...

  10. Android Gradle 学习笔记(三):Gradle 日志

    在第一节,我们使用到了gradle -q hello命令行来运行Hello World,并对Hello World进行了简单的分析,了解到 gradle -q hello 的意思是要执行的build. ...

随机推荐

  1. 小白用Mac

    老话说的好,“最近老板发我一个Mac,但是不会用,嘎嘎嘎嘎” 1.安装软件 安装 Homebrew Homebrew:使用 Homebrew 安装 Apple 没有预装但 你需要的东西,尤其是非界面管 ...

  2. java8--- (Function、Predicate、Consumer) 通用函数式接口

    // public static void main(String[] args) throws InterruptedException { // https://blog.csdn.net/u01 ...

  3. [2019上海网络赛F题]Rhyme scheme

    题目链接 题意,求出合法的长度为n的字典序第k小字符串,合法的定义为除了最后一位,每一位的取值范围为'A'到'A'+pos-1,而最后一位的取值范围'A'到当前字符串最大值+1. 队友tql,Orz ...

  4. C++基础-类和对象

    本文为 C++ 学习笔记,参考<Sams Teach Yourself C++ in One Hour a Day>第 8 版.<C++ Primer>第 5 版.<代码 ...

  5. 服务性能指标:PV、UV、TPS、QPS

    名词解释 PV Page View,网页浏览量.网页被读者调用浏览的次数.网页每次打开或刷新一次页面,记录一次.用户对同一页面的多次访问,访问量累计. UV Unique Visitor,独立访问者. ...

  6. 解决Java线程池任务执行完毕后线程回收问题

      转载请注明出处:http://www.cnblogs.com/pengineer/p/5011965.html         对于经常使用第三方框架进行web开发的程序员来说,Java线程池理所 ...

  7. Windows 环境下安装redis 及其PHP Redis扩展

    1.安装Redis (1)这里选择在github官网上下载Redis,地址:Redis下载地址 下载压缩包(如下图),并解压到本地目录,我放在D:\redis (2)验证Redis安装是否成功打开命令 ...

  8. ssm中web配置各框架的配置文件路径方式

    一.在web文件中配置 使用逗号隔开 二.在applicationContext.xml文件中配置或引用 以下是引用方式 注: <import />标签要放在所有bean配置的最前面.  

  9. 30. Substring with Concatenation of All Words (JAVA)

    You are given a string, s, and a list of words, words, that are all of the same length. Find all sta ...

  10. R语言parse函数与eval函数的字符串转命令行及执行操作

    parse()函数能将字符串转换为表达式expression:eval()函数能对表达式求解 A <- : B <- 'print(A)' class(B) C <- parse(t ...