Gradle installation and use in Eclipse

Gradle is an open source tool for building automation projects based on Apache Ant and Maven concepts of Apache. It uses a domain-specific language based on the Groovy (DSL) to declare the project settings, abandoned the XML-based variety of complicated configurations.

1, download the official
https://gradle.org/install/#manually

The latest version is 5.0, download gradle-5.0-bin.zip

2, the unpack the archive and configuration environment variables based on the actual path

GRADLE_HOME=D:\java\gradle-5.0
PATH=%GRADLE_HOME%\bin

3, verify the installation , at the input gradle -v cmd command line, normally there will be the following message:

Welcome to Gradle 5.0!

Here are the highlights of this release:
 - Kotlin DSL 1.0
 - Task timeouts
 - Dependency alignment aka BOM support
 - Interactive `gradle init`

For more details see https://docs.gradle.org/5.0/release-notes.html


------------------------------------------------------------
Gradle 5.0
------------------------------------------------------------

Build time:   2018-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 2018
JVM:          1.8.0_111 (Oracle Corporation 25.111-b14)
OS:           Windows 7 6.1 amd64

4, Eclipse installation gradle plug
(1) in Eclipse select Help -> Eclipse Marketplace ..., enter buildship click Go, and then select Install to install Gradle plugin: Buildship Gradle Integration3.0
(2) installation is complete restart Eclipse.

5, Eclipse create gradle Project
  File -> Other -> Gradle - > Gradle Project

6、Eclipse导入gradle项目
  File -> Import -> Gradle -> Existing Gradle Project

7, gradle project profile Description :
(. 1) the build.gradle
item automatically compile time to read the configuration file, such as specifying the dependencies projects.
(2) gradle.properties
defines a set of constants for build.gradle use.
(3) gradlew and gradlew.bat
gradlew shell script under Linux, gradlew.bat is a batch file for Windows. gradlew is an abbreviation gradle wrapper, that it gradle of command packaging, such as we enter into the specified Module directory and execute "gradlew.bat assemble" to complete the construction of the current Module (Windows system).
(4) settings.gradle
the entire project management, if our project contains more than one Module, we want to build all-time Module to complete the construction of the entire project, then we need to use this file. For example, our project contains ModuleA and ModuleB these two modules, then the file will contain this statement: include ': ModuleA', ' : ModuleB'.

8, import Gradle project on Github

Once imported, the code have a lot of errors, because the relevant jar package is not loaded, the need to manually: Right Item Configuration -> Add gradle Nature.

Guess you like

Origin blog.csdn.net/gdjlc/article/details/84882320