concept convention in category gradle

appears as: convention, convention, conventions, conventions
Gradle in Action - corrected 9052019

This is an excerpt from Manning's book Gradle in Action - corrected 9052019.

Using Ant across many projects within an enterprise has a big impact on maintainability. With flexibility comes a lot of duplicated code snippets that are copied from one project to another. The Maven team realized the need for a standardized project layout and unified build lifecycle. Maven picks up on the idea of convention over configuration, meaning that it provides sensible default values for your project configuration and its behavior. The project automatically knows what directories to search for source code and what tasks to perform when running the build. You can set up a full project with a few lines of XML as long as your project adheres to the default values. As an extra, Maven also has the ability to generate HTML project documentation that includes the Javadocs for your application.

Figure 2.5. In Gradle, Java projects are build by convention with sensible defaults. Changing the defaults is easy and achieved through convention properties.

As Java developers, we’re spoiled by extensive tooling and build automation support. Concepts like build-time dependency management of external libraries and convention over configuration for project layouts have been around for years and are part of our day-to-day vocabulary. In JavaScript land, commonly accepted patterns and techniques for build automation are in their early stages of development. Gradle doesn’t provide first-class support for JavaScript and CSS, but we’ll discuss how to use its API to implement typical usage scenarios, like combining and minifying JavaScript files.

In chapter 8, we talked about a guiding principle for separating concerns in plugins: capabilities versus conventions. Let’s quickly recap this concept. A plugin that provides a capability oftentimes introduces new concepts or tasks, and a plugin that provides conventions imposes opinionated defaults for these concepts. What might sound very abstract becomes strikingly clear by dissecting the inner workings of the Java plugin.