What is Configuration?

I want to know very basic idea of configuration word used in Gradle Documentation.
I have read about 20 - 25 pages of Gradle Doc but confused with configuration word.
I have installed and practiced Grdle in my PC. Help me configuration word with a very basic elementary idea.

A Configuration is a FileCollection that evaluates lazily, on demand.

The following block

configurations {
dependencies {
   foo 'com.foo:bar:1.0'
task printFoo {
   doLast {
      println "$configurations.foo.files"

Creates a Configuration called “foo” and adds a Dependency to it. If the printFoo task is executed it will invoke Configuration.getFiles() which ultimately calls Configuration.resolve(). This will invoke Gradle’s dependency resolution which might download the dependency (and any transient dependencies) from a remote repository before returning a Set<File>

A real world example is the “compile” configuration used by the “java” plugin

1 Like

In the Gradle documentation you may see references to Gradle’s configuration phase. This configuration phase is different than the configurations described by @Lance above. Some people will also call this the evaluation phase. You can read more on Gradle’s phases here.

For more information on configurations and dependencies I encourage you to read the Dependency Management section of the Gradle user guide.

1 Like