Gradle初识

1、安装配置

gradle官方网站https://gradle.org/,下载下来是一个压缩包,解压到合适的目录便可,而后配置环境变量(GRADLE_HOME,Path),略去。java

2、IDEA配置

New Project时选择Gradle做为构建工具。web

值得关注的配置以下。spring

建立的项目的结构如图所示maven

最重要的配置文件就是build.gradle,他的功能相似于maven中的pom.xml.进行依赖的管理项目的构建等。spring-boot

3、配置示例

plugins {
    id 'java'
}

group 'com.winner'
version '1.0'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    //testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile(
         "junit:junit:4.12"
    )
    compile (
            "io.netty:netty-all:4.1.10.Final",
            "org.springframework.boot:spring-boot-starter-web:2.1.0.RELEASE"
    )
}
相关文章
相关标签/搜索