Gradle Plugins TODEPLETE: Difference between revisions
Jump to navigation
Jump to search
Line 43: | Line 43: | ||
classpath 'com.netflix.nebula:gradle-ospackage-plugin:4.3.0' | classpath 'com.netflix.nebula:gradle-ospackage-plugin:4.3.0' | ||
} | } | ||
} | |||
</syntaxhighlight> | |||
=The plugin Script Block= | |||
<font color=darkgray>What is this for? It seems to be the only way to apply some plugins:</font> | |||
<syntaxhighlight lang='groovy'> | |||
plugins { | |||
id "org.sonarqube" version "2.6" | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 01:18, 1 November 2018
External
Internal
Overview
Most of Gradle's power comes from external plugins. A plugin is an extension to Gradle which configures the project it is applied to in some way, typically by adding plugin-specific dependency configurations, tasks and properties. Plugins can be applied to Projects because Project implements PluginAware.
Plugin List
- Java Plugin
- Application Plugin
- War Plugin
- Maven Plugin
- Maven Publish Plugin
- ANTLR Plugin
- Spring Boot Plugin
Plugin Initialization
apply plugin:'java'
External Plugins
If a build requires external plugins that need to be downloaded dynamically, build.gradle allows for a special script block buildscript{...} to declare where to download those plugins from. If the plugin is unknown, Gradle will fail with:
Plugin with id 'nebula.ospackage-application' not found.
An external plugin is declared as follows:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.netflix.nebula:gradle-ospackage-plugin:4.3.0'
}
}
The plugin Script Block
What is this for? It seems to be the only way to apply some plugins:
plugins {
id "org.sonarqube" version "2.6"
}