目 录CONTENT

文章目录

centos7中安装gradle

DevWiki
2017-07-20 / 0 评论 / 0 点赞 / 38 阅读 / 0 字 / 正在检测是否收录...
温馨提示:
本文最后更新于2024-03-31,若内容或图片失效,请留言反馈。 部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
updated: 2017/07/20 21:01:29
status: publish
author: DevWiki
categories: 
  - Linux
  - 工具
tags: 
  - gradle
  - Centos

0x01 创建gradle 目录

# cd /opt

# mkdir gradle

# ll

total 8
drwxr-xr-x 10 root root 4096 Jul 20 08:13 androidSdk
drwxr-xr-x  2 root root 4096 Jul 20 08:38 gradle

0x02 下载gradle并解压缩

根据需要下载需要的版本

# cd gradle

# wget https://services.gradle.org/distributions/gradle-4.0.1-bin.zip

--2017-07-20 08:38:18--  https://services.gradle.org/distributions/gradle-4.0.1-bin.zip
Resolving services.gradle.org (services.gradle.org)... 104.16.174.166, 104.16.173.166, 104.16.172.166, ...
Connecting to services.gradle.org (services.gradle.org)|104.16.174.166|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://downloads.gradle.org/distributions/gradle-4.0.1-bin.zip [following]
--2017-07-20 08:38:19--  https://downloads.gradle.org/distributions/gradle-4.0.1-bin.zip
Resolving downloads.gradle.org (downloads.gradle.org)... 104.16.172.166, 104.16.171.166, 104.16.174.166, ...
Connecting to downloads.gradle.org (downloads.gradle.org)|104.16.172.166|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 67524421 (64M) [application/zip]
Saving to: 'gradle-4.0.1-bin.zip'

100%[==============================================================================================>] 67,524,421  51.8MB/s   in 1.2s

//下载多个版本后查看
# ll
total 524916
-rw-r--r-- 1 root root 45038784 Jul 18  2016 gradle-2.14.1-bin.zip
-rw-r--r-- 1 root root 70120398 Jan  3  2017 gradle-3.3-bin.zip
-rw-r--r-- 1 root root 70308689 Feb 20 09:59 gradle-3.4-bin.zip
-rw-r--r-- 1 root root 70310446 Mar  3 15:00 gradle-3.4.1-bin.zip
-rw-r--r-- 1 root root 73331577 Apr 10 09:46 gradle-3.5-bin.zip
-rw-r--r-- 1 root root 73302707 Jun 16 10:48 gradle-3.5.1-bin.zip
-rw-r--r-- 1 root root 67523890 Jun 14 11:22 gradle-4.0-bin.zip
-rw-r--r-- 1 root root 67524421 Jul  7 10:15 gradle-4.0.1-bin.zip

然后解压缩下载的文件:

# unzip gradle-4.0.1-bin.zip

Archive:  gradle-4.0.1-bin.zip
   creating: gradle-4.0.1/
  inflating: gradle-4.0.1/LICENSE  
  inflating: gradle-4.0.1/NOTICE   
   creating: gradle-4.0.1/media/
  inflating: gradle-4.0.1/media/gradle-icon-16x16.png  
  inflating: gradle-4.0.1/media/gradle-icon-48x48.png  
  inflating: gradle-4.0.1/media/gradle-icon-32x32.png  
  ...
  ...
  ...
  inflating: gradle-4.0.1/lib/plugins/xml-apis-1.3.04.jar  
  inflating: gradle-4.0.1/lib/plugins/hamcrest-core-1.3.jar

根据下载的文件,全部解压,最后结果如下:

total 524948
drwxr-xr-x 6 root root     4096 Jul 18  2016 gradle-2.14.1
-rw-r--r-- 1 root root 45038784 Jul 18  2016 gradle-2.14.1-bin.zip
drwxr-xr-x 6 root root     4096 Jan  3  2017 gradle-3.3
-rw-r--r-- 1 root root 70120398 Jan  3  2017 gradle-3.3-bin.zip
drwxr-xr-x 6 root root     4096 Feb 20 14:55 gradle-3.4
-rw-r--r-- 1 root root 70308689 Feb 20 09:59 gradle-3.4-bin.zip
drwxr-xr-x 6 root root     4096 Mar  3 19:53 gradle-3.4.1
-rw-r--r-- 1 root root 70310446 Mar  3 15:00 gradle-3.4.1-bin.zip
drwxr-xr-x 6 root root     4096 Apr 10 13:43 gradle-3.5
-rw-r--r-- 1 root root 73331577 Apr 10 09:46 gradle-3.5-bin.zip
drwxr-xr-x 6 root root     4096 Jun 16 14:41 gradle-3.5.1
-rw-r--r-- 1 root root 73302707 Jun 16 10:48 gradle-3.5.1-bin.zip
drwxr-xr-x 6 root root     4096 Jun 14 15:16 gradle-4.0
-rw-r--r-- 1 root root 67523890 Jun 14 11:22 gradle-4.0-bin.zip
drwxr-xr-x 6 root root     4096 Jul  7 14:08 gradle-4.0.1
-rw-r--r-- 1 root root 67524421 Jul  7 10:15 gradle-4.0.1-bin.zip

0x03 配置环境变量

/etc/profile添加环境配置,然后应用配置

# cd /etc

//配置gradle

...
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
export PATH=$PATH:/opt/androidSdk/tools/bin
export PATH=$PATH:/opt/androidSdk/platform-tools
export PATH=$PATH:/opt/gradle/gradle-4.0.1/bin
...

# source profile

查看配置结果

# gradle -version

------------------------------------------------------------
Gradle 4.0.1
------------------------------------------------------------

Build time:   2017-07-07 14:02:41 UTC
Revision:     38e5dc0f772daecca1d2681885d3d85414eb6826

Groovy:       2.4.11
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_131 (Oracle Corporation 25.131-b12)
OS:           Linux 2.6.32-042stab123.3 amd64

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin
博主关闭了所有页面的评论