Configuration 'compile' declares a dependency on configuration 'default' which is not declared in the module descriptor

I have a remote ivy repo that gradle logs into and downloads dependencies from. I kept getting the “configuration ‘compile’ declares a dependency on configuration ‘default’ which is not declared in the module descriptor” error for about two days and I could not figure it out. I saw this post and although he doesn’t spell it out it’s really answered:

So after getting this error for about two days, and I eventually tried doing this:

dependencies {
    it.default group: "com.mygroup", name: "lib-name", version: "latest.integration"
}

We know that default is a reserved keyword in groovy, so you have to prefix with “it.” to refer back to the dependecies object since default is a method in this case.

So…

A) I want people who are having this issue to know how about the work around.

B) I want to ask what I’m doing wrong.

What am I doing wrong? I don’t see anywhere on the internet people using it.default as the configuration for a dependency. Any ideas?

Have you pinpointed the culprit dependency? If so,
What is its ivy.xml content?

I’ve changed the names to protect the innocent:

<ivy-module version="1.0">
<info organisation="com.mygroup" module="lib-artifact1" branch="trunk" revision="current" status="integration" publication="20150822220007"/>
<configurations>
<conf name="master" visibility="public"/>
<conf name="runtime" visibility="public"/>
<conf name="source" visibility="public"/>
<conf name="javadoc" visibility="public"/>
<conf name="compile" visibility="private"/>
<conf name="test" visibility="private"/>
<conf name="scdoc" visibility="private"/>
</configurations>
<publications>
<artifact name="lib-artifact1" type="jar" ext="jar" conf="master"/>
<!--
<artifact name="lib-artifact1" type="source" ext="jar" conf="source" />
-->
</publications>
<dependencies defaultconfmapping="compile->master;test->master,runtime;runtime->master,runtime">
<dependency org="de.java2html" name="java2html" rev="5.0" revConstraint="latest.release" conf="scdoc->master" branch="trunk"/>
<dependency org="org.junit" name="junit" rev="4.7" conf="test" branch="trunk"/>
<dependency org="org.apache" name="log4j" rev="1.2.15" conf="compile,runtime" branch="trunk"/>
<dependency org="org.apache" name="commons-httpclient" rev="3.1" conf="compile,runtime" branch="trunk"/>
<dependency org="org.apache" name="commons-lang3" rev="3.1" revConstraint="latest.release" conf="compile,runtime" branch="trunk"/>
<dependency org="org.joda" name="time" rev="1.6" conf="compile,runtime" branch="trunk"/>
<dependency org="com.martiansoftware" name="jsap" rev="2.1" revConstraint="latest.release" conf="compile,runtime" branch="trunk"/>
<dependency org="com.mygroup" name="lib-artifact2" rev="current" revConstraint="latest.integration" conf="compile,runtime" branch="trunk"/>
</dependencies>
</ivy-module>

I’m throwing out an idea here, but could the problem come from the fact that you declare your ‘compile’ configuration with a private visibility in your ivy.xml ?
This makes it invisible from outside the ivy descriptor.
Therefore when gradle tries to check it, it can’t find it, and falls back to the ‘default’ configuration, that you don’t declare.

Note that the gradle internal ivy-publish plug-in publishes the following configuration block in a ‘regular’ ivy publication:
configurations
conf name=“default” visibility=“public” extends="runtime"
conf name=“runtime” visibility="public"
configurations

I’ve changed the ivy.xml file to this:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0">
  <info organisation="com.bigllc" module="lib-artifact1" branch="trunk" revision="current" status="integration" publication="20150822220007"/>
  <configurations>
    <conf name="master" visibility="public"/>
    <conf name="runtime" visibility="public"/>
    <conf name="source" visibility="public"/>
    <conf name="javadoc" visibility="public"/>
    <conf name="compile" visibility="public"/>
    <conf name="test" visibility="public"/>
    <conf name="scdoc" visibility="public"/>
    <conf name="default" visibility="public" extends="runtime" />
  </configurations>
  <publications>
    <artifact name="lib-artifact1" type="jar" ext="jar" conf="master"/>
    <!--<artifact name="lib-artifact1" type="source" ext="jar" conf="source" />-->
  </publications>
  <dependencies defaultconfmapping="compile->master;test->master,runtime;runtime->master,runtime">
    <dependency org="de.java2html" name="java2html" rev="5.0" revConstraint="latest.release" conf="scdoc->master" branch="trunk"/>
    <dependency org="org.junit" name="junit" rev="4.7" conf="test" branch="trunk"/>
    <dependency org="org.apache" name="log4j" rev="1.2.15" conf="compile,runtime" branch="trunk"/>
    <dependency org="org.apache" name="commons-httpclient" rev="3.1" conf="compile,runtime" branch="trunk"/>
    <dependency org="org.apache" name="commons-lang3" rev="3.1" revConstraint="latest.release" conf="compile,runtime" branch="trunk"/>
    <dependency org="org.joda" name="time" rev="1.6" conf="compile,runtime" branch="trunk"/>
    <dependency org="com.martiansoftware" name="jsap" rev="2.1" revConstraint="latest.release" conf="compile,runtime" branch="trunk"/>
    <dependency org="com.bigllc" name="lib-artifact2" rev="current" revConstraint="latest.integration" conf="compile,runtime" branch="trunk"/>
  </dependencies>
</ivy-module>

and it’s still not working. I also changed the second library’s ivy file to make sure all configurations are public and it has the default configuration but no such luck. I’m guessing it’s the ivy file that’s the problem so I’ll keep trying different things with that. I’m going to take out the other dependencies and try removing the configurations that aren’t normally generated by gradle (as you mentioned, it only creates default and runtime). I’ll post back after trying this.

I’ve knocked the ivy file down to this and still no go:

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="1.0">
  <info organisation="com.mygroup" module="lib-artifact1" branch="trunk" revision="current" status="integration" publication="20150822220007" />
  <configurations>
    <conf name="runtime" visibility="public" />
    <conf name="default" visibility="public" extends="runtime" />
  </configurations>
  <publications>
    <artifact name="lib-artifact1" type="jar" ext="jar" conf="runtime" />
  </publications>
</ivy-module>

I’m not sure what to do now.

I’m going to try setting up a local repo to see if I can reproduce the issue.

I did not include my build.gradle either, so here’s that:

apply plugin: "java"
apply plugin: "groovy"

version = "1.0"

repositories {
    ivy {
        url "http://ivy.mygroup.com/ivy/build"
        layout "pattern", {
            artifact "[organisation]/[module]/trunk/[revision]/[type]/[artifact].[ext]"
            ivy "[organisation]/[module]/trunk/[revision]/ivy.xml"
        }
        credentials {
            username "username"
            password "password"
        }
    }
    mavenCentral()
}

dependencies {
    testCompile 'junit:junit:4.12'
    compile "org.codehaus.groovy:groovy-all:2.3.11"
    compile group: "com.mygroup", name: "lib-artifact1", version: "latest.integration"
}

Last blind try here:
Put ‘conf=“runtime->default”’ in the ivy.xml for your dependency artifact
I.e. ‘artifact name=“lib-artifact1” type=“jar” ext=“jar” conf=“runtime->default”’

Didn’t help. Thanks for trying!