- Mastering Gradle
- Mainak Mitra
- 447字
- 2021-07-16 20:49:33
Installation and quick start
Gradle installation is quite simple. You can download the Gradle distribution from the Gradle home page at https://www.gradle.org/downloads, which is available in different formats.
Pre-requisites
Gradle requires a Java JDK or JRE to be installed, needing version 6 or higher (to check the Java version on your machine, use java -version
). Some of the features might not work with JRE, so it is recommended to have JDK installed. Also, Gradle ships with its own Groovy library; therefore, Groovy does not need to be installed. Any existing Groovy installation is ignored by Gradle.
Gradle is available in three formats:
Alternatively, you can just download gradle-[version]-bin.zip
file.
Once downloaded, you need to unpack the zip file and configure it as per your operating system.
Gradle for Windows
Following are the steps for installing Gradle on Windows:
When you are ready to go ahead with Gradle, verify your installation by running the gradle
command with the --version
or -v
command-line parameter.
> gradle –version ------------------------------------------------------------ Gradle 2.4 ------------------------------------------------------------ Build time: 2015-05-05 08:09:24 UTC Build number: none Revision: 5c9c3bc20ca1c281ac7972643f1e2d190f2c943c Groovy: 2.3.10 Ant: Apache Ant(TM) version 1.9.4 compiled on April 29 2014 JVM: 1.7.0_79 (Oracle Corporation 24.79-b02) OS: Windows 8.1 6.3 amd64
Gradle for Mac/Linux
Following are the steps to install Gradle on the Mac/Linux operating system.
Reload the profile by executing source ~/.profile
and execute the gradle –version
command. You will be able to see a similar output as mentioned in the previous section.
The Gradle JVM option
Gradle shares the same JVM options set by the environment variable JAVA_OPTS
. If you don't want to use this setting and want to pass arguments specifically to the Gradle runtime, you can use the environment variable GRADLE_OPTS
.
Suppose if JAVA_OPTS=512MB
in your system and you want to increase the default maximum heap size to 1024MB
for Gradle application. You can set it like this:
GRADLE_OPTS="-Xmx1024m"
We can apply this setting in the project-specific build file. Alternatively, we can also apply this setting to all of the Gradle build by adding the variable to the Gradle startup script (this will be discussed later in this chapter).
- 小創客玩轉圖形化編程
- Java 9 Programming Blueprints
- UI智能化與前端智能化:工程技術、實現方法與編程思想
- Bootstrap Essentials
- The HTML and CSS Workshop
- Learning Three.js:The JavaScript 3D Library for WebGL
- Apache Spark 2.x for Java Developers
- 微服務從小白到專家:Spring Cloud和Kubernetes實戰
- Cocos2d-x Game Development Blueprints
- 零基礎學C語言(第4版)
- 計算機應用基礎案例教程(第二版)
- Java從入門到精通(視頻實戰版)
- Mastering Vim
- Game Development Patterns and Best Practices
- Visual C++ 開發從入門到精通