IDEA中gradle的配置和使用

1,去官网下载

https://gradle.org/releases/

2,gradle和maven对比

两者都是项目工具,maven属于行业标准,Gradle是后起之秀,Gradle抛弃了Maven的基于XML的繁琐配置,XML的阅读体验比较差,对于机器来说虽然容易识别,但毕竟是由人去维护的。取而代之的是Gradle采用了领域特定语言Groovy的配置,大大简化了构建代码的行数。

如下,maven和gradle在引入依赖上面的区别:

<dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>
dependencies {
    compile('org.springframework:spring-core:2.5.6')
    compile('org.springframework:spring-beans:2.5.6')
    compile('org.springframework:spring-context:2.5.6')
    testCompile('junit:junit:4.7')
}

3,gradle环境配置

首先和maven一样开箱即用,直接解压到系统盘即可

 其中user_home是我自己创建用来存放下载依赖的地方,zip压缩包是我把下载的包一块丢了进来

环境变量配置:

path中添加:

 

 测试:gradle -v

4,idea配置

原文地址:https://www.cnblogs.com/zhulei2/p/13384477.html