Hi everyone I have a KMP/CMP project, where I have...
# multiplatform
r
Hi everyone I have a KMP/CMP project, where I have a ktor server and a desktop application. I made a Kotlin run configuration for each of them and also checked “Allow multiple instances”. I can run them individually and it work, but when I want to run them in parallel, so I can connect the desktop app to the server, the second task started is waiting to be executed until the first finishes. How can I fix this?
c
Well, that's not how Gradle works. You will need to run them separately.
You could ask in the Gradle Community Workspace if someone there has an idea a to run 2 Gradle tasks „in parallel“. https://gradle.org/slack-invite/
Next question would actually be, why you want to run them in parallel? Just create 2 run configurations and run both of them separately.
r
I created two separate run configurations and start them individually, but as long as one rund configuration is running, the second starts, but is blocked until I stop the first one.
c
And just to be sure, by run configuration you are talking about the IntelliJ configuration that you can then run clicking the „Play“ button?
r
Yes, but in Android Studio
these are the two configs. As side note, I have a shared module, that is used by both
c
ah, I usually create “gradle” configurations that run the resp. tasks.
image.png,image.png
As side note, I have a shared module, that is used by both
same, I share the DTO’s
r
Thanks for your screenshot. In my case it doesnt work. I also disabled io.ktor.development=false or org.gradle.caching=false but still the same with gradle run configurations or kotlin run configurations 🤔
c
if you run them from the CLI - which tasks is the one “waiting”
also run it with
--info
, maybe there are hints whats going on.
r
when running from terminal, it works running first:
./gradlew :adminToolServer:run
second:
./gradlew :adminTool:jvmRun -DmainClass=com.example.admin.MainKt
Only when running from Android Studio it is blocked. It is always the second task that is blocked when running.
c
Then I’m out of ideas. 😞
r
Thanks anyway. Will see if I can figure out a way.
👍🏻 1
z
This is intentional behavior from Android Studio, it prevents two Gradle tasks running in parallel (whatever those might be), to avoid potential conflicts between them: https://issuetracker.google.com/issues/396841270
IntelliJ IDEA doesn't have this behavior, there you can just freely run multiple Gradle tasks.
c
ah, yeah, I’m using IntelliJ.
i
Everyday I'm more convinced all the android tooling is malware 😛
2
c
You did not read the the issue report, did you?
r
@zsmb thanks for the clarification. I will switch to IntelliJ then 👍🏻
z
You can also of course run things from the terminal so they go undetected by Studio 😄 And in the long term it probably makes sense to have better defined run configs for other platforms like Android has, as suggested in the issue discussions somewhere, but I don't think there's been any movement on that yet.