What is the use of builldscript closure

Hello Team,

in our project, few dependencies are mentioned in the buildscript {} closure as shown below.
My doubt is we have to declare the dependencies in dependency closure but why few dependencies are mentioned in the buildscript? what is the advantage of it?

		classpath 'com.wf.genesis.gradle:fortify-plugin:3.3.0'
		classpath 'org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:1.1.2'
		classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.3.02'


They are dependencies of your build script, not your project.
They are Gradle plugins.
But actually, doing it that way is legacy and discouraged.
You should instead just use the plugins { ... } block to apply Gradle plugins, then you don’t need that if the plugins are published properly including their marker artifact.

1 Like