zoukankan      html  css  js  c++  java
  • Gradle 学习笔记

    配置 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'
    
  • 相关阅读:
    情感日记:离校,漂流他乡
    汉化破解:{smartassembly}使用指南
    金融市场:Open.Yale.course:Financial.Markets.07.Chi_Eng
    【转载】[解决系统服务运行应用程序的权限问题]使用WTSGetActiveConsoleSessionId()的VISTA服务与桌面交互
    【转载】关于sqlserver自增长列的问题
    【转载】如何给IIS添加能访问的文件类型
    【原创】使用反射之后,强制类型转化不成功的问题在哪?
    【转载】网站开发人员应该知道的61件事
    【索引】转载关于DSL、代码生成器使用、依赖注入方式
    【原】使用SoundPlayer播放wav文件时产生杂音如何处理
  • 原文地址:https://www.cnblogs.com/liweiwei1419/p/6766114.html
Copyright © 2011-2022 走看看