https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
l

Lawik

04/09/2019, 7:24 AM
Does anyone have experience with setting up gretty in a multiplatform project? (or the war plugin)
t

thana

04/09/2019, 7:45 AM
not directly, but with the spring boot plugin. We ended up with another module targeting JVM only and we built our executable jar form that other module
l

Lawik

04/09/2019, 7:55 AM
I'd prefer not to use spring for this project. Were you still able to access common code from your JVM module using this setup?
t

thana

04/09/2019, 7:55 AM
the other module only existis to configure the aretefact. it does not contain any other code or logic
so this is not a "to spring or not to spring" question 😉 What i want to say is: at least we were not able to make use of spring boot to configure and create the jvm artifact (a jar in out case, a war in your case) when using an MPP. But that was made wasy as soon as we introduced a new gradle module which's only use was to configure this artefact. no furhter code required
l

Lawik

04/09/2019, 8:03 AM
I think I understand what you're trying to say, I'm trying it out right now(never used multiple modules within Gradle before). Do I have to define the dependencies to be included in the war twice, once in the main build.gradle and once in the new module's build.gradle?
t

thana

04/09/2019, 8:04 AM
no, the new module only contains a dependency on the actual module as well as the tools you need to creater your artifact
there is not that mich of a difference between a gradle multi-module project and e.g. a maven multi-module project
l

Lawik

04/09/2019, 8:11 AM
How do I add the dependency on the actual module?
I added the submodule to my settings.gradle.
t

thana

04/09/2019, 8:27 AM
implementation project(":otherModule")
l

Lawik

04/09/2019, 9:13 AM
For some reason my js jar file is added into the war instead of the jvm jar file.
t

thana

04/09/2019, 9:26 AM
at thsi point, i can't help 😄
l

Lawik

04/09/2019, 9:32 AM
Yeah, I think I will attempt writing a task that will create a war file manually using the CLI instead of the plugin as this should give me more control. Thanks a lot for your help though!
👍 1
5 Views