Setting up publications on a pure js lib .i.e `plu...
# gradle
a
Setting up publications on a pure js lib .i.e
plugins { kotlin("js") }
Copy code
val sourcesJarTaskProvider = tasks.register("sourcesJar", Jar::class.java) {
  archiveClassifier.set("sources")
  val kotlin = extensions.findByType<KotlinJsProjectExtension>() ?: return@register
  from(kotlin.sourceSets["main"].kotlin.srcDirs)
}

create<MavenPublication>("main") {
  from(components["kotlin"])
  artifact(sourcesJarTaskProvider.get())
}
Results in the following gradle error
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':publishMainPublicationToMavenLocal'.
> Cannot query the value of this property because it has no value available.
The error isn't descriptive as much, but it has to do with publishing. What am I doing wrong? All I need is to publish a pure js klib to maven central
v
If you run with
-s
you get a stack trace showing you the exact line where it happens