Last active
December 12, 2018 16:37
-
-
Save oxc/04441d27b974975f92306fa1292e8d43 to your computer and use it in GitHub Desktop.
Demo: IDEA reads multiplatform module dependencies as jars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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