Gradle Plugin Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 13: Line 13:
A script plugin is simply a file containing Gradle DSL code and possibly in-line Java and Groovy code. It can be thought as an "include file".
A script plugin is simply a file containing Gradle DSL code and possibly in-line Java and Groovy code. It can be thought as an "include file".
<syntaxhighlight lang=''>
<syntaxhighlight lang=''>
apply from: ''
apply from: 'example.gradle'
</syntaxhighlight>
</syntaxhighlight>
Conventionally, the file has the ".gradle" extension, but that is not mandatory.
Conventionally, the file has the ".gradle" extension, but that is not mandatory.

Revision as of 04:01, 24 September 2020

External

Internal

TODO

Gradle Plugins TODEPLETE

Overview

A Gradle plugin is packaged code that uses the Gradle API to provide additional functionality and extend Gradle core. A Gradle plugin may introduce new tasks, new domain objects, conventions, project layouts and patterns for a specific problem domain. Plugins may even extend the core objects. Introducing their own conventions, plugins are "opinionated", encouraging the user to do things in a certain way. However, well written plugins must provide means to change the default conventions and make it work for non-standard projects.

Script Plugin

A script plugin is simply a file containing Gradle DSL code and possibly in-line Java and Groovy code. It can be thought as an "include file".

apply from: 'example.gradle'

Conventionally, the file has the ".gradle" extension, but that is not mandatory.

Binary Plugin

Using a Plugin

Plugin Extension

A plugin is a typical use case for an extension.

Standard Plugins

A standard plugin ships with the Gradle runtime.

Plugin Libraries

External Plugins

Writing Custom Plugins

Custom Binary Plugins