[Question/Help wanted] Resolving dependencies between the different Gradle modules
KUDOS for all the work you've put into this project. Great effort and result.
I am trying to integrate it in a simple framework I've been trying to develop for Kotlin MPP. However, I have run into an issue and can't seem to find a way around it so far.
I have the following project structure:
root
- demo - Kotlin MPP project
* dependency implementation project(":annotations")
* dependency implementation project(":core)
* applies 'gradle-plugin'
- annotations - Kotlin MPP projects, contains annotations that have to be processed at build time
- compiler-plugin-common - Koltin JVM project, the annotation processor implementation
* dependency implementation "com.something:annotations-jvm:0.0.1"
- compiler-plugin-jvm-js - Plugging in the processor for JVM/JS
- compiler-plugin-native - Pluggin in the processor for Kotlin / Native
- core - Kotlin MPP project, the framework implementation
- gradle-plugin - Gradle compiler plugin, resolved dependencies to the per platform annotation processing logic
When I try and run a gradle build on demo, it fails to resolve the transitive dependency on com.something:annotations-jvm:0.0.1 with :
org.gradle.internal.component.AmbiguousConfigurationSelectionException: Cannot choose between the following variants of com.something:annotations-jvm.0.0.1:
@danailalexiev Hi, thank you. I think you need to import it something like this:
implementation project(path: ':annotations', configuration: 'default')
@danailalexiev Hi, thank you. I think you need to import it something like this:
implementation project(path: ':annotations', configuration: 'default')
Hi,
I tried using implementation project(path: 'annotations'). It resolves the dependency correctly and I'm able to use the classes, defined in annotations. However, when I try and build the demo project that also depends on the annotations, I get a java.lang.ClassNotFoundException for the classes in annotation when the annotation processor kicks in.
EDIT: This happens only when trying to build the JVM target. Building the iOS target is working fine. I assume that is because the compiler-plugin-native uses shadowJar to build a fat JAR. Does the compiler-plugin-jvm-js have to build a fat JAR as well? That's not the case in your examples or any of the projects that you've listed.