How do i package a kotlin/js front end app with a ...
# javascript
c
How do i package a kotlin/js front end app with a backend spring boot application. Currently, I have both application developed separately. And I have to manually copy the kotlin/js distribution into the resources directory of the spring boot application. which feel like a bit of manual labor. Is there a way to integrate both into a single module? I know about kotlin multiplatform but I have no idea how will it behave with spring boot gradle plugin.
c
You can create a Gradle task that copies the files from one project to another: https://gitlab.com/opensavvy/formulaide/-/blob/legacy/server/build.gradle.kts#L87 (this is a prototype, to make it a proper task you should create it with
register
instead of
copy
, and you should name the task outputs instead of hard-coding the directories, but you get the idea)
c
I could do that. But, I am trying to figure out a more elegant solution.
c
What would be "more elegant"? That's exactly what you asked.
c
More elegant as in finding a way where one gradle module is being used.
c
If you have a backend and a frontend, it seems normal to me to use two modules? They are not two implementations of the same thing, they are completely different modules.
b
You can just add js output dir to backend module resources directly
But if you insist on a single module you can do something like this instead https://github.com/mpetuska/kamp/blob/master/app/build.gradle.kts#L103
a
I do discourage single module approach
b
Me too
c
Thanks everyone.