Gradle download and installation

Ant and Maven shareconsiderable success in the Java market. ANT is a tool that released its first version in 2000 and is based on the development of procedural programming ideas. Later, with the help of Apache-Ivy, the ability of the network to accept plugins and dependency management has improved. But the main disadvantage is the use of XML as a format to write build scripts. XML is hierarchical, which is not conducive to program programming, and becomes difficult to manage when XML files become large.

Introduced in 2004, Maven is a big improvement over ANT. It changed the structure and continued to use XML to write the generation specification. Maven's dependency conventions and the ability to download dependencies over the network. The main benefit of Maven is its lifecycle. While successive projects have the same life cycle, this comes at the cost of flexibility. Maven also faces some issues with dependency management. It doesn't handle inconsistencies between versions of the same library, and complex custom build scripts are actually harder to write in Maven than in ANT.

Finally, Gradle was released in 2012, bringing some more efficient features.

Gradle is a project automation build tool based on Apache Ant and Apache Maven concepts. It uses a Groovy-based Domain-Specific Language (DSL) to declare project settings, ditching the cumbersome XML-based configuration. Mainly for Java applications. Currently its supported languages ​​are limited to Java, Groovy and Scala, with plans to support more languages ​​in the future. Using Gradle, we write the required build logic into the build.gradle file for easy viewing and reuse.


Download and installation tutorial

1. First, we search for Gradle on Baidu and find the download page of the official website (https://services.gradle.org/distributions/) as shown in the figure below, we choose the release version we want to install, gradle-xx-bin.zip is The installation release that needs to be downloaded, gradle-xx-src.zip is the source code, and gradle-xx-all.zip is to download all the files. My local is gradle-4.7-rc-2-bin\gradle-4.7-rc-2



2. The source code downloaded by Gradle does not need to be installed. We can directly decompress the downloaded compressed package in the local directory. The decompressed directory is shown in the figure below.



3. Configure Gradle to configure environment variables, right-click "This Computer" --> "Properties" --> "Advanced System Settings" --> "Environment Variables" --> "System Variables", we add a new system variable A GRADLE_HOME value is the decompressed path, and then we also need to modify the Path variable and add the Gradle bin directory. We add ;%GRADLE_HOME%\bin at the end of the Path variable. Note that the preceding semicolon (;) must not be few.




4. After the configuration is complete, let's check the version information of the gradle installed on the machine. Use the shortcut key Win+R to enter cmd in the input box that pops up, and then open the command window. Enter gradle -v or gradle -version in the command window to view to the version information of gradle, as shown in the following figure.



That's it.




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324501833&siteId=291194637