Closed tom-pratt closed 3 weeks ago
Could you share you project? It looks like you also have jvm target in your mpp module.
Theres a comment above the line including compose.runtime in jvm. If you comment out that line then the errors occurs.
The issue is that you have single module project and this module contains both server and Js code. You use Compose plugin in this module, so it is used for all sourceSets. Compose plugin forces usage of Compose Compiler plugin, that checks compose runtime presence. So your build scripts uses Compose for server side.
I would suggest to separate Server and JS code into separate modules.
Ok that makes sense. Although that is the project structure provided in the official sample project for frontend/backend kotlin! Are there any examples using separate modules that you can link to? I suppose you need a third, library module to share the reusable parts between front and backend.
https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform
I have a similar problem, I'm adding a spring project to my compose for web project. And I get this error.
@Artrosis have you split the code into two modules?
@akurasov No, I added "implementation(compose.runtime)". I have little experience to do this on my own. I have a Spring project that depends on the build artifacts of a Compose for web project. I would like to have an example application with different Spring and compose for web modules.
I would like to have an example application with different Spring and compose for web modules.
There is no such at the moment, but probably we should create one.
Hey there, I am facing the same issue. Any plan on creating a multi-module project example like mentioned above? Is there maybe an existing project on GitHub I can check out? Would love to be able to use JB Compose with a Kotlin backend :nerd_face:
I'm also struggling to make it work. I've managed to split demo project into three modules common, server (ktor) and web: https://github.com/a-blekot/jvm-js-fullstack (main branch)
But applications run independently on different ports
server: localhost:8080 (:server:run) web: localhost:8081 (:web:jsBrowserDevelopmentRun)
And I can't register task in the server module to copy webpack output from :web to :server. :web:jsBrowserDevelopmentWebpack Please help))
@a-blekot Hello! Your project page is not available (https://github.com/a-blekot/jvm-js-fullstack) Can you open your repository or make reproducible sample without security sensitive code?
@dima-avdeev-jb Oh, sorry, I didn't notice that it is private. I will update it tomorrow morning cause I'm writing from mobile now)
@dima-avdeev-jb done, now it's public https://github.com/a-blekot/jvm-js-fullstack
@a-blekot Done in this PR: https://github.com/a-blekot/jvm-js-fullstack/pull/1
@dima-avdeev-jb Thank you!! It works perfectly now 🥳
Is this issue still open as a suggestion for a feature to be able to enable/disable the compose compiler per source set in Multiplatform? Or should a new issue be opened for that suggestion?
@mgroth0 You can create a new Issue for your suggestion as a enhancment
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
The
compileKotlinJvm
task fails with:androidx.compose.compiler.plugins.kotlin.IncompatibleComposeRuntimeVersionException: The Compose Compiler requires the Compose Runtime to be on the class path, but none could be found. The compose compiler plugin you are using (version 1.1.0-beta01) expects a minimum runtime version of 1.0.0.
Unless I add
implementation(compose.runtime)
tojvmMain.dependencies
But this feels weird since I'm only using compose for the js target.