Reputation: 4245
I am totally new to Gradle (and Groovy syntax) so I have difficulties understanding some concepts.
One of them are dependencies and configurations.
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.springframework:spring-core:4.1.1.RELEASE'
}
From the above build.gradle file I understand that dependencies is a build script script block (a method which takes a closure as a parameter). It is defined in the Project object.
The compile is a so called configuration. It is defined in the Java plug in.
Upvotes: 1
Views: 196
Reputation: 4462
The build script is the entire content of a .gradle file, hence the dependencies {}
block is not the build script, it's part of the build script.
I would term dependencies {}
a configuration block, not in the sense of dependency configurations but in the general sense of configuration. Within that block you define dependency configurations and attach modules/libraries to them.
In answer to your specific questions:
- Is it also a method which takes one argument as a parameter?
There are several different syntaxes that you can use, but this is the simplest. It is in effect a method call with one argument that is the dependency coordinate (group:name:version).
- How it affects the dependencies script block or the overall build in this case?
I don't really understand this question. It doesn't affect the dependencies {}
block. What you're doing is interacting with the Gradle API to model your build. In this case, you're simply telling Gradle that one of the compilation dependencies for your build is Spring Core 4.1.1.RELEASE.
Hope that helps.
Upvotes: 3