File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ Add dependencies (you can also add other modules that you need):
8585``` xml
8686<dependency >
8787 <groupId >org.jetbrains.kotlinx</groupId >
88- <artifactId >kotlinx-coroutines-core</artifactId >
88+ <artifactId >kotlinx-coroutines-core-jvm </artifactId >
8989 <version >1.10.1</version >
9090</dependency >
9191```
Original file line number Diff line number Diff line change 1- import org.gradle.api.tasks.testing.*
2- import org.gradle.kotlin.dsl.*
31import org.jetbrains.kotlin.gradle.plugin.mpp.*
42import org.jetbrains.kotlin.gradle.targets.native.tasks.*
53import org.jetbrains.kotlin.gradle.tasks.*
@@ -182,15 +180,23 @@ val jvmJar by tasks.getting(Jar::class) { setupManifest(this) }
182180 * This manifest contains reference to AgentPremain that belongs to
183181 * kotlinx-coroutines-core-jvm, but our resolving machinery guarantees that
184182 * any JVM project that depends on -core artifact also depends on -core-jvm one.
183+ *
184+ * To avoid a conflict with a JPMS module provided by kotlinx-coroutines-core-jvm,
185+ * an explicit automatic module name has to be specified in the manifest.
185186 */
186- val allMetadataJar by tasks.getting(Jar ::class ) { setupManifest(this ) }
187+ val allMetadataJar by tasks.getting(Jar ::class ) {
188+ setupManifest(this , " kotlinx.coroutines.core.trampoline" )
189+ }
187190
188- fun setupManifest (jar : Jar ) {
191+ fun setupManifest (jar : Jar , autoModuleName : String? = null ) {
189192 jar.manifest {
190- attributes(mapOf (
193+ attributes(
191194 " Premain-Class" to " kotlinx.coroutines.debug.internal.AgentPremain" ,
192- " Can-Retransform-Classes" to " true" ,
193- ))
195+ " Can-Retransform-Classes" to " true"
196+ )
197+ autoModuleName?.also {
198+ attributes(" Automatic-Module-Name" to it)
199+ }
194200 }
195201}
196202
You can’t perform that action at this time.
0 commit comments