[Gradle User Guide] Gradle features and gradle User Guide features

Source: Internet
Author: User

[Gradle User Guide] Gradle features and gradle User Guide features

Reprinted please indicate the source: http://blog.csdn.net/zhaokaiqiang1992

This article translated from Gradle User Guide, if you want to view the original, please stamp http://www.gradle.org /.

1. Introduction

We would like to introduce Gradle to you. Gradle is a building system and we think it is a leap development in the Java World.

Gradle provides us:

(1) A general build tool as flexible as Ant

(2) A switchable framework built based on conventions like Maven. Conventions are better than configurations.

(3) powerful support for multi-project construction

(4) powerful dependency management based on Apache lvy

(5) fully support existing Maven and lvy Repositories

(6) Support for pass-through dependency management, without the need for remote repositories or pom. xml and ivy. xml files

(7) suitable for building Ant tasks and build

(8) Groovy build script

(9) rich domain models to describe your build

In Unit 2, you will find more about Gradle. In addition, there are more tutorials waiting for you to learn. Thank you :-)


1.1 about this User Guide

This user guide, like Gradle itself, is in rapid development. Some parts of Gradle are not completed yet. Some content is not accurate, or you may have learned a lot about Gradle. We need you to complete this user guide. You can find more documents on Gradle's official website.

In this document, you will find some charts used to indicate the dependencies between tasks. These tools are similar to the dependency symbols in UML. The first task points to another task, which indicates that the first task depends on the other.

2. Overview 2.1 features

The following lists the features of Gradle:

(1) declarative build and Protocol build

The core of Gradle is Groovy-based rich and extensible domain-specific language (DSL). By providing custom declarative language elements, Gradle passes dependencies to the next layer, these elements also provide support for protocol construction in many languages, such as java, Groovy, OSGI, Web, and Scala projects. Even the declarative language is extensible. You can have your own new language elements or enhance existing ones. This provides a simple, easy-to-maintain, and understandable building process.

(2) Dependency Programming Language

Declarative languages are built on a general task diagram and can be fully utilized in your build tasks. It provides the most flexible tool to meet your unique needs.

(3) Structured Construction

Gradle's flexibility and richness allow you to build projects with general design principles. For example, the logic for Building Reusable logical blocks is very simple. Do not try to force something that should have been together, such as the project hierarchy. This will avoid project decentralization, because scattered projects will make your build process a nightmare! Finally, you can build a well-structured, easy-to-maintain, and understandable building process.

(4) Deep API

Throughout the lifecycle of building execution, you can embed many hooks. Gradle allows you to detect and customize configurations and perform very core behaviors.

(5) Gradle Scales

Gradle Scales is very good, it can increase your productivity. From a simple single project to a multi-project building of an enterprise. With the increase of functions, it can solve the problems in the construction process of many large enterprises.

(6) Multi-Project Construction

Gradle provides excellent support for multi-project building. Gradle also provides partial building. If you build a single project, Gradle builds the directory of the entire project, you can choose to build some projects, incremental build can greatly save your time.

(7) dependency management in many ways

Different teams prefer to manage external dependencies in different ways. Gradle provides support for all methods. You can use a remote dependency management library, such as Maven and ivy, or a local file system.

(8) Gradle is the first integrated build tool.

Ant tasks are supported. More interesting, Ant projects are also supported. Gradle provides in-depth support for Ant projects. during runtime, you can convert Ant's targets to local Gradle tasks. You can depend on or improve Ant in Gradle. You can even re-declare the dependency on build. xml in the Gradle task. Gradle supports existing Maven repositories and Ivy repositories. Gradle also provides tools to convert Maven pom. xml into Gradle scripts. The import time for Maven projects is approaching.

(9) Easy migration

Gradle can adapt to any structure you have, so you can build a project in the production environment where the project runs. We generally recommend that you write a test program to ensure that the project runs normally, gradle can be used to minimize project migration problems. This is also the best practice for project reconstruction, that is, "baby steps ".

(10) Groovy

Gradle uses Grovvy to write scripts instead of XML, because Groovy is more readable than XML. Gradle is not designed to provide a strict framework. Gradle provides some standards, but it cannot be modified. This is the difference and characteristic between Gradle and other declarative build systems. Groovy is more than just sugar clothing. Adding Groovy has a pleasant and fruitful experience.

(11) Gradle Wrapper

Gradle Wrapper allows you to run the Gradle script on a machine without Gradle installed. It is very useful on some continuous integration servers.

(12) Free Open Source

Gradle is an open-source project and is authorized using the ASL protocol.


2.2 why Groovy?

We believe that domain-specific languages (based on dynamic languages) have great advantages over XML in script construction. There are many dynamic languages. Why Groovy? The reason is that gradle is a general build tool, but the main focus is the Java project. In such a project group, everyone is familiar with Java, so we hope to be transparent to all members.

In this case, you may ask why we do not directly use java as the scripting language? This is because although Java is powerful, it also has limitations. In this case, it is not as powerful as Python, Groovy, and Ruby, and Java is too complicated. Groovy is the same as Java and has its own characteristics.

The above arguments are not applicable to the knowledge or desire of Java developers to learn from Python or Ruby. It is well designed to create another build script engine or Jython in JRuby. But we do not have the highest priority. We strongly support any community's efforts to create additional build script engines.

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.