Skip to content
This repository has been archived by the owner on Dec 20, 2022. It is now read-only.

[Question/Help wanted] Resolving dependencies between the different Gradle modules #14

Open
danailalexiev opened this issue Mar 12, 2020 · 2 comments

Comments

@danailalexiev
Copy link

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 danailalexiev changed the title Resolving dependencies between the different Gradle modules [Question/Help wanted] Resolving dependencies between the different Gradle modules Mar 12, 2020
@Foso
Copy link
Owner

Foso commented Mar 12, 2020

@danailalexiev Hi, thank you. I think you need to import it something like this:

implementation project(path: ':annotations', configuration: 'default')

@danailalexiev
Copy link
Author

danailalexiev commented Mar 16, 2020

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants