1. Installation Environment
Download the latest version number of Gradle in http://www.gradle.org. Then unzip, write the Bin folder to the environment variable,
Then enter Gradle in the terminal, assuming that the following information appears, for example, to indicate that the installation was successful.
?
2.project Configuration
Create a common javaproject in eclispse, creating a Build.gradle file under the project folder.
?
Write in Build.gradle file
?
You can see the results of the execution by typing Gradle run in the terminal.
?
This is the simplest gradle compilation, the execution of Javaproject. At this point, the following results are compiled for class, jar packages, and so on in the project folder.
Configuration dependencies
Add the source of the third-party library to the Build.gradle file, and then add the name of the library that we need to rely on.
?
So that we can use this library function. And it doesn't have to be us. This dependency package is downloaded locally and then added to the dependency, which is what Gradle gives us great convenience.
We execute Gradle run again and get the following results for example:
?
4 using Gradle Warpper to build project
Gradle Warpper Building project does not require the installation of Gradle, only project has performed Gradle Warpper, including the following code in project:
?
Then execute the Gradle wrapper in the terminal. Project will add two wrapper files.
?
At this point, you just need to execute gradlew run.
?
The first time will download the corresponding Gradle version number, the following will not be required, gradle small try to here.
Gradle Compiling javaproject Small test