Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What the difference in applying gradle plugin

I don't understand gradle plugins block

apply plugin: 'someplugin1' apply plugin: 'maven' 

and other one:

plugins {    id 'org.hidetake.ssh' version '1.1.2' } 

In first block We have some plugin name. in second one package and version. I don't understand where I should use first block and when second one.

like image 611
Yevgen Kulik Avatar asked Sep 02 '15 12:09

Yevgen Kulik


People also ask

What does Gradle apply plugin do?

Applying a plugin to a project allows the plugin to extend the project's capabilities. It can do things such as: Extend the Gradle model (e.g. add new DSL elements that can be configured) Configure the project according to conventions (e.g. add new tasks or configure sensible defaults)

Which Gradle plugin to use?

Android Gradle plugin 7.2.

What is Gradle and Gradle plugin?

Gradle is the build system. You can use it with a lot of plugins. One of these is the Android Gradle plugin. It is used to provide processes and configurable settings that are specific to building and testing Android applications.

What is android Gradle plugin?

The Android Gradle plugin (AGP) is the official build system for Android applications. It includes support for compiling many different types of sources and linking them together into an application that you can run on a physical Android device or an emulator.


1 Answers

The plugins block is the newer method of applying plugins, and they must be available in the Gradle plugin repository. The apply approach is the older, yet more flexible method of adding a plugin to your build.

The new plugins method does not work in multi-project configurations (subprojects, allprojects), but will work on the build configuration for each child project.

I would think that as functionality progresses, the plugins configuration method will overtake the older approach, but at this point both can be and are used concurrently.

like image 158
cjstehno Avatar answered Oct 11 '22 12:10

cjstehno