Skip to content

Instantly share code, notes, and snippets.

@oxc
Last active December 12, 2018 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oxc/04441d27b974975f92306fa1292e8d43 to your computer and use it in GitHub Desktop.
Save oxc/04441d27b974975f92306fa1292e8d43 to your computer and use it in GitHub Desktop.
Demo: IDEA reads multiplatform module dependencies as jars
If a (java) project depends on two kotlin-multiplatform libraries that depend on each other,
this causes strange behaviour when importing the project in IntelliJ IDEA: the java-project
classpath gets a compile entry containing two jar files, pointing to the gradle build path
of the two libraries' jars (see `issue-jar-dependency.png`).
If the transitive dependency is comment out in the java-project dependencies, it gets imported
correctly, even though the transitive dependency is marked as "implementation" in the other
libary (see `issue-module-dependencies.png`).
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.11' apply false
}
allprojects {
repositories {
jcenter()
}
}
project('library1') {
apply plugin: 'kotlin-multiplatform'
kotlin { targets { fromPreset(presets.jvm, 'jvm') } }
}
project('library2') {
apply plugin: 'kotlin-multiplatform'
kotlin {
targets { fromPreset(presets.jvm, 'jvm') }
sourceSets {
jvmMain {
dependencies {
implementation project(':library1')
}
}
}
}
}
project('java-project') {
apply plugin: 'java'
dependencies {
implementation project(':library1') // "works" if this line commented out
implementation project(':library2')
}
}
rootProject.name = 'mpp-jardep'
include "java-project"
include "library1"
include "library2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment