-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
When trying to run an individual KMP test in IJ/AS, getting this error:
Cannot locate tasks that match ':shared:money:impl:compileJava' as task 'compileJava' is ambiguous in project ':shared:money:impl'. Candidates are: 'compileDebugAndroidTestJavaWithJavac', 'compileDebugJavaWithJavac', 'compileDebugUnitTestJavaWithJavac', 'compileReleaseJavaWithJavac', 'compileReleaseUnitTestJavaWithJavac'.

OSemenovBoyarka and asapha
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Kantis commentedon Mar 6, 2023
Can you provide a repro for this? It looks like a gradle error to me. The Kotest plugin never explicitly calls the
compileJava
taskkirillzh commentedon Mar 11, 2023
@Kantis, I see this happening when trying to run/debug individual tests from IDE. Seems to work fine with the whole test suite though:

kirillzh commentedon Apr 19, 2023
I see this in modules that don't have JVM target (eg Android or iOS), without debugger as well. The only way that I was able to make unit tests run from IDE is by right clicking on a spec file and running from there:

stale commentedon Jun 18, 2023
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
[-]Trying to debug jvm test throws `Task 'compileJava' not found in project`[/-][+]Unable to run individual tests[/+][-]Unable to run individual tests[/-][+]Unable to run individual tests KMP tests[/+]kirillzh commentedon Jul 28, 2023
@Kantis, I update the title and description of the ticket. The real issue that I'm seeing is that we are not able to run individual tests from IDE (clicking green arrow next to a
test
), whereas running the whole spec works (clicking green arrow next to a spec). Is there anything I can do to help debug this issue?Nek-12 commentedon Aug 17, 2023
I have the same problem. This should be reopened @kirillzh
jvmTest
and KMP library targetsandroidJvm
andjvm
#264kirillzh commentedon Sep 28, 2023
@Kantis, do you have any pointers for how this issue could be resolved? Happy to attempt fixing this in the plugin itself but not sure where to look. Would appreciate your help here, thanks!
kirillzh commentedon Sep 28, 2023
The plugin does seem to generate the right configuration:
However when executing it for a KMP module it fails, here are the IDE logs:
Gradle output error:
OSemenovBoyarka commentedon Nov 21, 2023
The same issue here, just creating blank KMP project with Android and iOS targets (no JVM). and adding Kotest following official docs reproduces this.
If I add JVM target - plugin works well.
TadeasKriz commentedon Dec 8, 2023
I've been debugging and prodding IntelliJ IDEA and the Android plugin's source code and found that there's actually a registry setting for IntelliJ IDEA. When you set the
Registry...
setting calledandroid.task.runner.restricted
to true (checking the box), it will make sure that Android task runner is only used for modules with the Android facet. Thanks to this it will correctly use the Gradle task runner and compile the underlying module correctly.We still need to see if this can be enabled long-term and I'll be reaching out to JB to see if there's a reason not to use it and what's the plan for it. But being able to run Kotest from the gutter icons again is sweet!
7 remaining items