Gradle Building Java Engineering

Source: Internet
Author: User

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&nbsp ;            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

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.