Gradle Compiling javaproject Small test

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.