Czar
11/21/2017, 11:21 AMapi
in dependencies {
api(...)
}
is still not being resolved, strange because implementation(...)
is and works.Czar
11/21/2017, 11:31 AMeskatos
11/21/2017, 11:34 AMplugins {}
block?
Does that configuration exist in your build?
What happen if you use "api"(..)
instead?eskatos
11/21/2017, 11:36 AMjava
plugin but not the java-library
plugin. So the api
configuration does not exist, that’s why it’s accessor is not available.Czar
11/21/2017, 12:19 PMid 'java-library'
, child project (build.gradle.kts) looks like this:
apply<JavaLibraryPlugin>()
apply { plugin("org.jetbrains.kotlin.jvm") }
dependencies {
api(..)
}
At the moment I've added fun DependencyHandler.api(dependencyNotation: Any): Dependency = add("api", dependencyNotation)
and it works, it also works with "api"
, but I try to avoid that syntax whenever possible.Czar
11/21/2017, 12:23 PMapply<KotlinPlatformJvmPlugin>()
the equivalent of apply { plugin("org.jetbrains.kotlin.jvm") }
or are these different plugins?eskatos
11/21/2017, 12:32 PMapply { plugin(..) }
, that’s expected.
You should use the plugins {}
block in your child projects too.eskatos
11/21/2017, 12:32 PMplugins {
id("something") version "1.0" apply false
}
and then in your child projects:
plugins {
id("something")
}
if you want to keep the version declaration in one placeeskatos
11/21/2017, 12:34 PMjava-library
as it is a core plugin, but it does to org.jetbrains.kotlin.jvm
Czar
11/21/2017, 12:36 PMorg.jetbrains.kotlin.jvm
already being on classpath.Czar
11/21/2017, 12:37 PMPlugin 'org.jetbrains.kotlin.jvm' is already on the script classpath. Plugins on the script classpath cannot be applied in the plugins {} block. Add "apply plugin: 'org.jetbrains.kotlin.jvm'" to the body of the script to use the plugin.
eskatos
11/21/2017, 12:41 PMCzar
11/21/2017, 12:42 PMeskatos
11/21/2017, 12:44 PMCzar
11/21/2017, 12:45 PMCzar
11/21/2017, 12:47 PMeskatos
11/21/2017, 12:47 PMeskatos
11/21/2017, 12:47 PMCzar
11/21/2017, 12:50 PMplugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
}
api
is still not resolved, plus stdlib functions can't be resolved now. I had this working in 4.0.1 with apply
, now it doesn't (checkNotNull not resolved):
val lib: Map<String, Any> by extra
fun lib(key: String) = checkNotNull(lib[key]) {
"Could not find dependency \"lib.$key\". Did you forget to add it to libraries.gradle?"
}
Czar
11/21/2017, 12:56 PMCzar
11/21/2017, 12:56 PMeskatos
11/21/2017, 12:57 PM