Here's how to create a common Java project, and then say how to create a Web project 1. gradle installation: Go to gradle official website (http://gradle.org/) to download the bin package, according to the development system to download the appropriate version 2. Modify environment variables, add gradle Bin directory path to path, and enter gradle-v in CMD to join successfully. 3. started using Gradle for project building, the general way is that the source code will be put into the CVS (version control system) for management, but the local development of the general use of the IDE, here I use eclipse, so it involves how to build through Gradle Eclipse Project, Import in eclipse for development. Create common Java engineering 1. First create the Project catalog: for example, D: D:\code\testGradle2. Create a Build.gradle file in the Testgradle directory, similar to MAVEN's Pom.xml file, which determines the entire gradle build process. Build.gradle content as follows: Apply plugin: ' java ' & nbsp Apply plugin: ' Eclipse ' repositories { &N Bsp mavencentral () } &NB Sp targetcompatibility = 1.7 dependencies { testcompile ' junit:junit:4.+ ' }3. Establish the Gradle default code structure in the Testgradle directory, the code structure diagram is as follows: Src/main/java Source code Src/test/java & nbsp: Test code src/main/resources resource files src/test/resources test resources Create 4 according to your needs. cmd into the Testgradle directory, enter Gradle eclipse. This creates an Eclipse project that is managed by Gradle. Gradle's job here is to generate the. classpath files and. project files that are needed for the Eclipse project, and the directories created in 3 will be added to the. classpath file, and you can open the. classpath file to view, To create a Web project, I used to create the Web project as a normal project, then package it into a war package, deploy it to a test machine for testing, and take advantage of some automated build tools. 1. First create the Project catalog: for example, D: D:\code\testWebGradle2. Create a Build.gradle file in the Testwebgradle directory, similar to MAVEN's Pom.xml file, which determines the entire gradle build process. Build.gradle content is as follows: &N Bsp Apply plugin: ' War ' ' Apply plugin: ' Eclipse ' &nbs P repositories { Mavencentral () } targetcompatibility = 1.7  ; dependencies { TESTCOMPI Le ' junit:junit:4.+ ' }3. Establish gradle default code structure in the Testgradle directory, the code structure diagram is as follows: Src/main/java Source code Src/test/java & nbsp Test code Src/main/webapp web related files directory src/main/resources resource files Src/test/resources Test resources Create 4 based on your needs. cmd into the Testgradle directory, enter Gradle eclipse. This creates an Eclipse project that is managed by Gradle. Gradle's job here is to generate the. classpath files and. project files that are needed for the Eclipse project, and the directories created in 3 will be added to the. classpath file, and you can open the. classpath file to view, This is followed by the use of the Gradle command, which can be packaged with commands such as Gradle build
Gradle Building Java Project