A dependency on configuration 'default'


I’m getting the following error when trying to run my Gradle script:

Module version group:myGroup, module:myModule, version:1.0, configuration:testCompile declares a dependency on configuration 'default' which is not declared in the module descriptor for group:myGroup, module:myJarFile, version:1.0

My understanding was that if I don’t specify which configuration to depend on, I utilise ‘default’. Does this need to be explicitly defined in the script? I’m not doing so at the moment. If I do so:

configurations {

I get the following:

> startup failed: build file '<directory>\build.gradle': 12: unexpected token: default @ line 12, column 5.
    1 error


The problem is that “default” is a keyword in Groovy (and Java).

You can use the following code:

dependencies {

This works because

dependencies {

Is the same as:


When you use the closure version, the ‘dependencies’ object is passed to the closure as the implicit argument, and Groovy supports using strings as property names for situations like this (and others).

I have tried adding this code to the build script:

dependencies {

… and I now get the following error:

groovy.lang.MissingPropertyException: No such property: default for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
        at build_9nk811bjk2lvcjfv5uodt9ie1$_run_closure1.doCall(<directory>\build.gradle:12)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:141)
        at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:90)
        at org.gradle.api.internal.project.AbstractProject.dependencies(AbstractProject.java:880)
        at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:196)
        at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:102)
        at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:99)
        at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:83)
        at build_9nk811bjk2lvcjfv5uodt9ie1.run(<directory>\build.gradle:11)
        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)

I think Luke meant ‘configurations’, not ‘dependencies’.

Hmmm… if I include the following in my script:

configurations {

… then I get the same error as previously about declaring a dependency on configuration ‘default’ which is not declared in the module descriptor.

Without a reproducible example, there isn’t much I can do. Usually it isn’t necessary to declare a ‘default’ configuration.

Not sure how to progress this as it’s still an issue but the error is associated with in-house jars which are utilised as part of the testCompile task. If I replace the dependency declaration:

testCompile "jarGroup:jarName:latest.integration"

… with the following:

testCompile group: "jarGroup", name: "jarName", version: "latest.integration", configuration: "core"

… then it works, even though I have not declared a configuration called “core” in the script anywhere.

Followup: I think the issue arises because the jar - created in Ivy - was done so as part of a configuration called “core”. This is per the section entitled “Depending on modules with multiple artifacts” in the Dependency management section.