JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.99k stars 1.16k forks source link

Cannot locate tasks that match ':desktopApp:compileJava' as task 'compileJava' not found in project ':desktopApp'. #3662

Closed mironoff2007 closed 1 year ago

mironoff2007 commented 1 year ago

https://github.com/JetBrains/compose-multiplatform-template/

Android Studio Iguana | 2023.2.1 Canary 3 Build #AI-232.9559.62.2321.10773421, built on September 7, 2023 Runtime version: 17.0.8+0--10699129 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 16 Registry: external.system.auto.import.disabled=true debugger.new.tool.window.layout=true ide.text.editor.with.preview.show.floating.toolbar=false ide.instant.shutdown=false ide.experimental.ui=true

Non-Bundled Plugins: com.squareup.sqldelight (2.0.0) org.jetbrains.compose.desktop.ide (1.5.1)

Cannot locate tasks that match ':desktopApp:compileJava' as task 'compileJava' not found in project ':desktopApp'.

mironoff2007 commented 1 year ago

Same result in Giraffe Android target builds fine image Desktop not image

Clean project, invalidate caches and restart does not help

Please, help

mironoff2007 commented 1 year ago

Steps to reproduce. 1) Pull template. 2) Add new branch. 3) Add new module, link it. (any common module) 4) Try to build. See build error. 5) Checkout main 6) Clean project 7) You can't build desktop target

MatkovIvan commented 1 year ago

Hi @mironoff2007,

I've been trying to replicate the problem that you're facing, but without success. The compileJava task seems to be not required for this project, as there's no Java code included. Therefore, it is quite unclear what exactly is triggering it.

With regards to reproduction steps, both 4 and 7 seem to operate well on my end. It would be highly beneficial if you could share with us the entire project, inclusive of all the modifications you've made to our template. This would greatly aid in the identification of the issue.

mironoff2007 commented 1 year ago

I've deleted fork and pull template again. I had same error. But I realised that I use different run method. Is this method wrong? It worked before in my pet projects, but it is broken in pet project in same way.

image

In pet projects I'm using jvm { withJava() } instead of just jvm() in build.kts. With this desktop target builds, but I causes runtime no class found exceptions for dependencies outside of desktop module

MatkovIvan commented 1 year ago

Indeed, I've reproduced that - this method doesn't quite function as expected when attempted via Android Studio, although it works seamlessly in IntelliJ IDEA. This method is perfectly valid and should ideally perform without a hitch, but it seems to be some sort of an issue specific to the Android Studio IDE.

At present, I would recommend using the "desktopApp" run configuration - simply utilize the run button located on the top bar.

I'm going to close this issue as it appears to be more related to Android Studio rather than a problem inherent to Compose Multiplatform. I would suggest that you bring this to the attention of Google's Android Studio IDE via their issue tracker. They should be able to provide further assistance in this regard.

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.