从PPA安装Padle 6 On Ubuntu 20.04/18.04/Debian 10 Linux

时间:2020-02-23 14:32:58  来源:igfitidea点击:

Gradle是一个开源构建自动化工具,专注于性能,速度和灵活性。
Gradle Build脚本是使用Groovy或者Kotlin域的语言编写的。

Gradle设计用于高度可定制和可扩展的。
它能够通过并行执行任务来实现更高的速度,从先前的执行和处理只有更改的输入进行处理。

在Ubuntu 18.04/Debian 10 Linux上安装Gradle

本教程将介绍我们通过所有步骤安装Ubuntu 18.04/Debian 10上的最新版本。

第1步:安装预先要求

Gradle需要Java JRE或者OpenJDK功能。
如果未安装Java,请使用下面的命令安装它。

sudo apt update
sudo apt install -y default-jdk

检查Java是否已通过查询版本来安装:

$java --version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing))

第2步:下载并安装Gradle

安装了Java后,下一步是下载并安装Gradle。
可以从链接检查最新的Gradle发布。

从PPA存储库安装Padle on Ubuntu 20.04/18.04

我们将使用PPA存储库在Ubuntu 18.04/16.04上安装Gradle,以便于更新和管理。

通过运行以下命令将PPA存储库添加到系统到系统:

sudo apt -y install vim apt-transport-https dirmngr wget software-properties-common
sudo add-apt-repository ppa:cwchien/gradle

更新系统并安装Gradle

sudo apt-get update
sudo apt -y install gradle

确认已安装的Gradle版本:

$gradle -v
Welcome to Gradle 6.0.1!
Here are the highlights of this release:
 - Substantial improvements in dependency management, including
   - Publishing Gradle Module Metadata in addition to pom.xml
   - Advanced control of transitive versions
   - Support for optional features and dependencies
   - Rules to tweak published metadata
 - Support for Java 13
 - Faster incremental Java and Groovy compilation
 - New Zinc compiler for Scala
 - VS2019 support
 - Support for Gradle Enterprise plugin 3.0
For more details see https://docs.gradle.org/6.0.1/release-notes.html

-----------------------------------------------------------
Gradle 6.0.1
-----------------------------------------------------------
Build time:   2019-11-18 20:25:01 UTC
Revision:     fad121066a68c4701acd362daf4287a7c309a0f5
Kotlin:       1.3.50
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.5 (Private Build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OS:           Linux 4.15.0-58-generic amd64

从PPA存储库安装Debian 10/9上的Gradle

对于Debian 9,请安装以下软件包:

sudo apt update
sudo apt -y install gnupg2
sudo apt -y install vim apt-transport-https dirmngr wget software-properties-common

然后导入GPG密钥:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D7CC6F019D06AF36

我们应该接收类似于下面的输出

Executing: /tmp/apt-key-gpghome.eGRTsZJki3/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys D7CC6F019D06AF36
gpg: key D7CC6F019D06AF36: public key "Launchpad PPA for Cheng-Wei Chien" imported
gpg: Total number processed: 1
gpg:               imported: 1

导入键后,添加PPA存储库

sudo add-apt-repository ppa:cwchien/gradle

更新Debian 9套餐列表

$sudo apt update
Hit:1 http://deb.debian.org/debian stretch-backports InRelease
Ign:4 http://download.webmin.com/download/repository sarge InRelease                                                                                  
Get:2 http://ppa.launchpad.net/cwchien/gradle/ubuntu disco InRelease [15.4 kB]
Hit:5 http://download.webmin.com/download/repository sarge Release                      
Get:6 http://ppa.launchpad.net/cwchien/gradle/ubuntu disco/main amd64 Packages [740 B]  
Ign:3 http://cdn-fastly.deb.debian.org/debian stretch InRelease                               
Hit:8 http://cdn-fastly.deb.debian.org/debian stretch Release
Fetched 16.1 kB in 3s (4351 B/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

最后通过运行安装Gradle:

sudo apt install gradle

验证Ubuntu 18.04/Ubuntu 16.04和Debian 9系统上安装的Gradle的版本。

$gradle --version
-----------------------------------------------------------
Gradle 5.0
-----------------------------------------------------------
Build time:   2016-11-26 11:48:43 UTC
Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987
Kotlin DSL:   1.0.4
Kotlin:       1.3.10
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2016
JVM:          11.0.1 (Oracle Corporation 11.0.1+13)
OS:           Linux 4.9.0-8-amd64 amd64

我们已在PPA存储库中成功安装了Ubuntu 18.04/Debian 9/Ubuntu 16.04的Gradle。