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"
    )
}
相關文章
相關標籤/搜索