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'
    
  • 相关阅读:
    DataBindings 与 INotifyPropertyChanged 实现自动刷新 WinForm 界面
    EasyInvoice 使用教程
    下载网页通用类
    c#操作excel的一些记录
    sql数据库基础知识整理,常用函数及常用语法
    动态行转列 pivot实现
    EFCodeFirst 数据迁移问题~
    asp.net 翻页时用ViewState保存上一页checkbox勾选的值
    参数化拼接in查询条件,个人备份
    retry
  • 原文地址:https://www.cnblogs.com/liweiwei1419/p/6766114.html
Copyright © 2011-2022 走看看