mockito / mockito-kotlin

Using Mockito with Kotlin
MIT License
3.11k stars 202 forks source link

Is 1.1 series fit for kotlin 1.2? #222

Closed happy15 closed 6 years ago

jschmid commented 6 years ago

@happy15 I'm using it with Kotlin 1.2 and did not have any problems with it yet.

happy15 commented 6 years ago

@jschmid nice to hear that. Let me check it out.

kyegupov commented 6 years ago

I actually do have problems in the form of:

> Could not resolve all dependencies for configuration ':myproject:testCompileClasspath'.
   > A conflict was found between the following modules:
      - org.jetbrains.kotlin:kotlin-stdlib:1.2.10
      - org.jetbrains.kotlin:kotlin-stdlib:1.1.2-4
      - org.jetbrains.kotlin:kotlin-stdlib:1.0.7
efimerdlerkravitz commented 6 years ago

@happy15 I have exactly the same issue @kyegupov has

nhaarman commented 6 years ago

What does your dependencies block look like?

efimerdlerkravitz commented 6 years ago

Actually adding , { exclude group: 'org.jetbrains.kotlin' } solved the error

nhaarman commented 6 years ago

Great that your issue is solved! Actually, I'd still like to know what causes this message, could you nevertheless supply your dependencies block?

efimerdlerkravitz commented 6 years ago

Sure

implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'

    compile 'com.bugfender.sdk:android:0.8.4'
    compile 'com.github.apl-devs:appintro:v4.2.2'

    // Firebase
    compile 'com.firebaseui:firebase-ui-auth:3.1.3'
    compile 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.firebase:firebase-messaging:11.8.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true
    }

    // Anko Commons
    compile "org.jetbrains.anko:anko-commons:$anko_version"
    compile "org.jetbrains.anko:anko-sdk25:$anko_version"
    compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"

    // Coroutine listeners for Anko Layouts
    compile "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
    compile "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"

    // Dagger 2
    compile 'com.google.dagger:dagger:2.13'
    kapt 'com.google.dagger:dagger-compiler:2.13'

    testImplementation 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:2.12.0'
    testCompile 'com.nhaarman:mockito-kotlin-kt1.1:1.5.0', { exclude group: 'org.jetbrains.kotlin' }
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    // Retrofit
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-moshi:2.3.0'

    // General purpose
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.squareup.picasso:picasso:3.0.0-SNAPSHOT'
    //noinspection GradleDependency
    compile 'com.squareup.moshi:moshi-adapters:1.4.0'
    compile 'com.evernote:android-job:1.2.1'
    compile 'com.squareup.tape2:tape:2.0.0-SNAPSHOT'
    compile 'com.github.tamir7.contacts:contacts:1.1.7'

    // Permissions
    compile("com.github.hotchemi:permissionsdispatcher:3.1.0") {
        // if you don't use android.app.Fragment you can exclude support for them
        exclude module: "support-v13"
    }
    kapt "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
nhaarman commented 6 years ago

Thanks! I'll look into it.

russhwolf commented 6 years ago

I had this issue as well. I think it would be fixed if mockito-kotlin used implementation instead of compile for the kotlin-reflect dependency in the build.gradle.

nhaarman commented 6 years ago

That would break builds for users not explicitly depending on the reflect library.

On Fri, Jan 26, 2018, 16:41 Russell Wolf notifications@github.com wrote:

I had this issue as well. I think it would be fixed if mockito-kotlin used implementation instead of compile for the kotlin-reflect dependency in the build.gradle.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nhaarman/mockito-kotlin/issues/222#issuecomment-360819101, or mute the thread https://github.com/notifications/unsubscribe-auth/AC4B8FOPw76ocBIVo_vDigvu8nwhvXrXks5tOfINgaJpZM4Q736Y .