Missing api configuration?

Trying to use the api configuration but got “Unresolved reference: api”

Gradle version 5.3.1

build.gradle.kts snippet:

plugins { groovy }
configurations.forEach{ println(it) }
dependencies {
    api("foo:bar:123")
}

These are listed:

configuration ':foo:annotationProcessor'
configuration ':foo:apiElements'
configuration ':foo:archives'
configuration ':foo:compile'
configuration ':foo:compileClasspath'
configuration ':foo:compileOnly'
configuration ':foo:default'
configuration ':foo:implementation'
configuration ':foo:runtime'
configuration ':foo:runtimeClasspath'
configuration ':foo:runtimeElements'
configuration ':foo:runtimeOnly'
configuration ':foo:testAnnotationProcessor'
configuration ':foo:testCompile'
configuration ':foo:testCompileClasspath'
configuration ':foo:testCompileOnly'
configuration ':foo:testImplementation'
configuration ':foo:testRuntime'
configuration ':foo:testRuntimeClasspath'
configuration ':foo:testRuntimeOnly'

Any reason why “api” is missing?

-cs

The groovy and java plugins do not provide the api configuration. The api configuration is added by the java-library plugin.

https://docs.gradle.org/current/userguide/java_library_plugin.html

1 Like