I just made the mistake to upgrade to the latest I...
# compose-desktop
m
I just made the mistake to upgrade to the latest IntelliJ EAP 2002.3 bringing me from a fully working multiplatform build to a completely defunct one. Can anybody tell me how I can fix the following build error?
Copy code
Cannot add task 'packageRelease' as a task with that name already exists.
Full stacktrace in thread ->
e
@Michael Paus I'm not using 2022.3, but I did have a similar error yesterday when I was accidentally applying both the Ktor and jb-compose plugins. I was able to remove Ktor's at that point as the Compose plugin's packaging support did what I needed.
m
I am not using the Ktor plugin and removing any other plugin would not help because I need them all.
e
What is the other plugin adding a
packageRelease
task then?
m
No idea. The stacktrace from Gradle is 370 lines long without providing any useful information.
e
I don't think it will show anything else, because it's the Compose plugin that's adding the second task. You could check the class of the first task, I guess, if you have a large number of plugins involved.
m
Further investigation reveals that the problem is not IntelliJ EAP 2022.3 but the forced updates that come with it. I was able to reproduce the problem with Jetbrains own falling-balls-mpp example and the previous version of IntelliJ 2022.2.2. In the gradle.properties of that project I changed the following configuration parameters with the indicated results. The last one reproduces the problem mentioned above.
Copy code
#<https://github.com/JetBrains/compose-jb/tree/master/experimental/examples/falling-balls-mpp>
#IntelliJ IDEA 2022.2.2 (Community Edition)

# Original (works)
#compose.version=1.2.0-alpha01-dev725
#kotlin.version=1.6.21
#agp.version=7.0.4

# Update AGP (works)
#compose.version=1.2.0-alpha01-dev725
#kotlin.version=1.6.21
#agp.version=7.2.2

# Update Compose and Kotlin (Compiler error)
#compose.version=1.2.0-alpha01-dev774
#kotlin.version=1.7.10
#agp.version=7.2.2

# Update Compose/Kotlin/AGP to latest (Cannot add task 'packageRelease' as a task with that name already exists.)
# Keeping agp.version=7.2.2 does not make a difference.
compose.version=1.2.0-beta01
kotlin.version=1.7.10
agp.version=7.3.0
Is there anything wrong with the combination of versions?
l
Yeah i'm also receiving this
@Michael Paus i think that the error is due to adding multiple compile targets to the same compose module
m
But what’s the alternative? Jetbrains created this setup on purpose. Do you know how to modify the falling-balls-mpp example so that it works again with the latest tools?
l
Check how projects are created by the Intellij GUI. Its not multiple compile targets, but the "build" action, being able to run for android/desktop/web in the same module. The intellij generated project creates one module for each platform
By the way, i didnt fully test this. But when i removed the other targets, my error changed. I havent had the opportunity to investigate further tho
Yeah, i was able to build my project after i commented the lines
Copy code
/compose.experimental {
//    web.application {}
//}
and changed the android application plugin to library plugin, so i was left only with the desktop build block
Copy code
compose.desktop {
    application {
         ...
    }
}
In the common module tho, it shouldnt have any compose targets, you should create submodules that import the common module and each submodule has its own build target.
m
Hallelujah 🎉🎉🎉, with the latest IJ 2022.3 EAP and Compose multiplatform 1.2.0-rc01 and AGP 7.3.0 everything seems to work again and even the falsely reported missing dependencies are gone. I can finally work again. A big thank you from my side to everybody. For the record: https://github.com/JetBrains/compose-jb/issues/2345