Gradle 2.0 User Manual-Overview (Translate)

Source: Internet
Author: User

2.1 Features

This chapter describes the features of a series of gradle.

Statement-building and contract-based construction

The core of Gradle is to present a rich, domain-specific language based on groovy, called Domain Specific Language (DSL). Through the free statement language element, Gradle to a new level of statement-building. These elements also provide the ability to build on conventions to support Java,groovy,osgi,web and Scala projects. Moreover, this statement language can be extended. You can add new elements, or enhance existing ones, to achieve concise, easy-to-maintain, and highly readable builds.

Dependency-based programming languages

Because the declarative language is at the top of the task map, you can be completely assured of adding Grale to your build. It provides enough flexibility to handle a wide variety of projects.

Build structured

Because the Gradle is powerful and easy to use, you can add common design rules to your build at your own discretion. For example, it is easy to build with reusable build logic. There should be no unnecessary inline relationships. Do not forcibly separate parts that are already together (for example, project hierarchies). Avoid scattered changes that will make the project difficult to maintain. In short, you can create a well-structured, easy-to-maintain, easy-to-understand build.

Underlying API

In the life cycle of running a build, Gradle provides a lot of inline hooks, which allows you to monitor and customize its configuration and execution logic from its core. This is one of the most enjoyable features.

Gradle Scales

Gradle Scales is really great, from a simple single project architecture to a large, enterprise-class, multi-project architecture that can handle it with significant efficiency gains.

Multi-Project Construction

Gradle's multi-project building capabilities are outstanding. Project dependency is important. Gradle allows users to shape the dependencies between them in a multi-project build. Gradle follows the intent of the user, rather than letting the user in turn follow the gradle requirements to complete the build.

Gradle can also do a partial build, and if you try to build a subproject, Gradle will build the subproject that this subproject depends on. You can also choose to rebuild other child projects on which the subproject depends. This can save a lot of time in some big projects.

Multiple ways to manage dependencies

Different teams have different ways of relying on management. Gradle provides a convenient way to support a variety of strategies. Whether it's dependency delivery management from a MAVEN warehouse or Ivy Warehouse, or a folder or jar package dependency on the local system, Gradle can handle it gracefully.

Gradle is the first integrated build tool

Ant task priority is supported. More importantly, the Ant project is also well supported. Gradle provides the underlying import to support the Ant project, and at run time, the ant task is converted to the native Gradle task. You can rely on or enhance them by gradle, and even declare their dependencies in your build.xml. Similarly, you can inherit properties,paths and so on.

Gradle fully supports existing Maven or ivy repositories to build dependencies for publishing and retrieval, and Gradle also provides a translator to convert maven pom.xml to Gradle scripts. Importing MAVEN projects at run time is also quickly introduced.

Ease of migration

Gradle can be adapted to a variety of structures. So you can always build different branches of your project in parallel. Usually we recommend writing some tests to make sure that these branches are the same. This way, the migration can be made more reliable. This is the best refactoring practice available using a gourd-based approach.

Groovy

Gradle build scripts are written through groovy, not through XML. And the other way is that this is not just a blunt demonstration of the power of dynamic language. That would make building maintenance very difficult. Gradle's overall design was designed to make gradle a widely used language, not just a rigid framework. Groovy is the link between Gradle and your project. Gradle provides some standard application scenarios, but these scenarios are not set up in a special place. Gradle's groovy support is more than just a gimmick. Gradle's API looks very similar to groovy, which is a very enjoyable and reliable experience.

Gradle Wrapper

Gradle wrapper allows you to perform Gradle builds in environments where Gradle is not installed. This is useful on a number of servers that are continuously integrated. Similarly, Gradle wrapper makes it easy to build some open source projects. Gradle Wrapper is also attractive to businesses because there is no need for any management of the terminal machines, and it is possible to specify a specific version of Gradle to avoid some of the problems that may arise.

Free and open source

Gradle is an open source project based on the ASL protocol.

2.2 Why is groovy?

We think the advantage of an internal DSL (based on dynamic language) over XML is obvious when you run the build script. There are many kinds of such languages, why is Grooby? The reason is that Gradle is an application environment. While Gradle's core goal is to be a build tool, its main application scenario is in Java projects where members are very familiar with Java. We believe that it is easy to learn and be familiar with all the applications that build the best for it, so choose Groovy.

For these reasons, you may ask why you are not using Java directly as the language of your build script. We think this is a very good question. If you use Java directly as the language of the build script, it might be the easiest way for your team to accept the lowest learning cost, but because of the limitations of the Java language itself, Java as a build language is not a very good solution (here you can find the answer, here is a good comparison of Ant,xml , Java and Lisp), like Python,groovy or Ruby, are better suited for building work than Java. We chose groovy just to provide the lowest learning curve for Java developers, whose basic syntax, notation, and package structure are very close to Java,groovy not only with Java, but also with more features.

For Java developers who have Python or Ruby at the same time, the above explanation may not be acceptable. Gradle is ideal for creating a new build script engine using JRuby or Jython, but this is not the highest priority task we currently have. We are happy to support any social group and individual to implement an additional build engine.

Http://www.cnblogs.com/wisekingokok/p/5113954.html

Gradle 2.0 User Manual-Overview (Translate) (EXT)

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.