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.


  • 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.