Gradle Plugins TODEPLETE: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=Internal=
* [[Gradle_Concepts#Plugin|Gradle Concepts]]
=Overview=  
=Overview=  


Most of Gradle's power comes from external plugins. A plugin is an extension to Gradle which configures the [[Gradle_Project_and_Build_Script#Overview|project]] it is applied to in some way, typically by adding plugin-specific [[Gradle_Dependencies_and_Dependency_Configurations#Dependency_Configuration|dependency configurations]], [[Gradle_Task#Overview|tasks]] and [[Gradle_Properties#Overview|properties]]. Plugins can be applied to Projects because Project implements [https://docs.gradle.org/current/dsl/org.gradle.api.plugins.PluginAware.html PluginAware].
Most of Gradle's power comes from external plugins. A plugin is an extension to Gradle which configures the [[Gradle_Project_and_Build_Script#Overview|project]] it is applied to in some way, typically by adding plugin-specific [[Gradle_Dependencies_and_Dependency_Configurations#Dependency_Configuration|dependency configurations]], [[Gradle_Task#Overview|tasks]] and [[Gradle_Variables_and_Properties#Overview|properties]]. Plugins can be applied to Projects because Project implements [https://docs.gradle.org/current/dsl/org.gradle.api.plugins.PluginAware.html PluginAware].
 
=Plugin Initialization=
 
<syntaxhighlight lang='groovy'>
apply plugin:'java'
</syntaxhighlight>


=Plugin List=
=Plugin List=
Line 19: Line 7:
* [[Gradle_Java_Plugin#Overview|Java Plugin]]
* [[Gradle_Java_Plugin#Overview|Java Plugin]]
* [[Gradle_Application_Plugin#Overview|Application Plugin]]
* [[Gradle_Application_Plugin#Overview|Application Plugin]]
* [[Gradle_Distribution_Plugin#Overview|Distribution Plugin]]
* [[Gradle_War_Plugin#Overview|War Plugin]]
* [[Gradle_War_Plugin#Overview|War Plugin]]
* [[Gradle_Maven_Plugin#Overview|Maven Plugin]]
* [[Gradle_Maven_Plugin#Overview|Maven Plugin]]
* [[Gradle_Maven_Publish_Plugin#Overview|Maven Publish Plugin]]
* [[Gradle_Maven_Publish_Plugin#Overview|Maven Publish Plugin]]
* [[Gradle_ANTLR_Plugin|ANTLR Plugin]]
* [[Spring Boot Gradle Plugin#Overview|Spring Boot Plugin]]
* [[Gradle Spring dependency-management Plugin#Overview|Spring dependency-management Plugin]]
* [[Gradle_Sonarqube_Plugin|SonarQube Plugin]]
* [[Gradle_Jacoco_Plugin|Jacoco Plugin]]
* [[Gradle IDEA Plugin|IDEA Plugin]]
* [[franzbecker gradle-lombok|franzbecker gradle-lombok]]
=Plugin Initialization=
<syntaxhighlight lang='groovy'>
apply plugin:'java'
</syntaxhighlight>


=External Plugins=
=External Plugins=


If a build requires external plugins that need to be downloaded dynamically, [[build.gradle]] allows for a special script block [[Gradle_Project_and_Build_Script#buildscript.7B.7D|buildscript{...}]] to declare where to download those plugins from. If the plugin is unknown, Gradle will fail with:
If a build requires external plugins that need to be downloaded dynamically, [[Gradle_Project_and_Build_Script#Overview|build.gradle]] allows for a special script block [[Gradle_Project_and_Build_Script#buildscript.7B.7D|buildscript{...}]] to declare where to download those plugins from. If the plugin is unknown, Gradle will fail with:


<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
Line 41: 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>

Latest revision as of 21:54, 21 October 2020

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

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"
}