Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package io.mockk does not exist - bump mockk from 1.12.5 to 1.12.7 #889

Closed
3 tasks done
jesperancinha opened this issue Aug 23, 2022 · 3 comments
Closed
3 tasks done

Comments

@jesperancinha
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

I want to keep usingevery

Current Behavior

It does not find io.mockk.every

Failure Information (for bugs)

It looks like a bug

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

Just run unit tests with every on version 1.12.7 or 1.12.16

GitHub Action Builds where this problem arises:

https://github.com/jesperancinha/sea-shell-archiver/runs/7973818681
https://github.com/jesperancinha/mancalaje/runs/7964939461
https://github.com/jesperancinha/advanced-library-management/runs/7962375745

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • MockK version: 1.12.7
  • OS: Linux / Mac-OS
  • Kotlin version: 1.7.10
  • JDK version: 17
  • JUnit version:
  • Type of test: unit test OR android instrumented test

Failure Logs

Please include any relevant log snippets or files here.

Stack trace

Error:  Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.7.10:test-compile (test-compile) on project advanced-library-mngmt-gate: Compilation failure: Compilation failure: 
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[6,11] Unresolved reference: mockk
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[7,11] Unresolved reference: mockk
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[43,9] Unresolved reference: every
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[43,83] Unresolved reference: mockk
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[45,9] Unresolved reference: every
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[55,9] Unresolved reference: every
Error:  /home/runner/work/advanced-library-management/advanced-library-management/advanced-library-mngmt-gate/src/test/kotlin/org/jesperancinha/management/gate/services/AlmG1BookServiceTest.kt:[56,9] Unresolved reference: every

Minimal reproducible code (the gist of this issue)

    @Test
    fun testGetBookCBByIdTestWhenTimeoutRetrieveSolution() {
        every { webClient.getBookViaReactiveServiceById(100L) } returns Mono.error<BookDto?>(ReactiveAccessException())
            .delayElement(Duration.ofMillis(500))
        every { webClient.getBookViaJpaServiceById(100L) } returns Mono.just(BookDto(0L, "SolutionOpen"))
@ghost
Copy link

ghost commented Aug 23, 2022

It seems the jar file in maven central is empty for 1.12.6 and .7:

~.m2/repository/io/mockk/mockk/1.12.7$ jar -tvf mockk-1.12.7.jar
     0 Tue Aug 23 13:52:30 CEST 2022 META-INF/
    25 Tue Aug 23 13:52:30 CEST 2022 META-INF/MANIFEST.MF
   589 Tue Aug 23 13:52:30 CEST 2022 META-INF/kotlin-project-structure-metadata.json
~.m2/repository/io/mockk/mockk/1.12.7$ $ ls -la
total 156
drwxr-xr-x 1 schrom schrom   4096 Aug 23 17:52 .
drwxr-xr-x 1 schrom schrom   4096 Aug 23 17:52 ..
-rwxr--r-- 1 schrom schrom    232 Aug 23 17:52 _remote.repositories
-rwxr--r-- 1 schrom schrom 150837 Aug 23 17:52 mockk-1.12.7-sources.jar
-rwxr--r-- 1 schrom schrom     40 Aug 23 17:52 mockk-1.12.7-sources.jar.sha1
-rwxr--r-- 1 schrom schrom    689 Aug 23 17:52 mockk-1.12.7.jar
-rwxr--r-- 1 schrom schrom     40 Aug 23 17:52 mockk-1.12.7.jar.sha1
-rwxr--r-- 1 schrom schrom   1935 Aug 23 17:52 mockk-1.12.7.pom
-rwxr--r-- 1 schrom schrom     40 Aug 23 17:52 mockk-1.12.7.pom.sha1

@aSemy
Copy link
Contributor

aSemy commented Aug 23, 2022

I guess this is because of #855, and Maven doesn't understand Kotlin multiplatform projects. UPDATE: I was wrong, this is a bug and will be fixed by #905

Can you try changing

<dependency>
  <groupId>io.mockk</groupId>
  <artifactId>mockk</artifactId>
  <version>${mockk.version}</version>
 </dependency>

to

<dependency>
  <groupId>io.mockk</groupId>
  <artifactId>mockk-jvm</artifactId>
  <version>${mockk.version}</version>
 </dependency>

NOTE

this is a temp fix, and won't be necessary in an upcoming MockK release

@jesperancinha
Copy link
Author

@aSemy It works! Thanks for the explanation 👍. I will keep this in mind when I see errors like this in the future.

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

No branches or pull requests

2 participants