is there a way to consume a multiplatform project ...
# multiplatform
a
is there a way to consume a multiplatform project with
jvm
target from
kotlin-jvm
module using
implementation(project(multiplatform-lib))
like in android or i have to publish to maven and consume from maven
j
You can add a local project module in the same way, yes.
a
thank you ok i've this situation right now and your help will be much appreciated i've:
main_project
: // includes 1.
currently_working_on_jvm_module
2.
github_submodule_project
: // inculdes •
kmp_library_with_jvm_target
• settings.gradle.kts 3. settings.gradle.kts how do i depend on
kmp_library_with_jvm_target
from
currently_working_on_jvm_module
what changes needs to be done to
main_project
settings.gradle.kts and
currently_working_on_jvm_module
build,.gradle files to depend on
kmp_library_with_jvm_target
currently i'm adding; in
main_project
settings.gradle.kts : includeBuild(
github_submodule_project
) and in
currently_working_on_jvm_module
build.gradle.kts: implementation(project(
kmp_library_with_jvm_target
)) but i'm getting: Project with path
kmp_library_with_jvm_target
couldn't be found in project:
currently_working_on_jvm_module
p
Are the two projects siblings under the same parent directory. Or one project contains the other project?
Show how you add the new project in the settings
a
there is the
main project
which is considered the most upper level and another seperate project inside it added as git submodule which is its own project and doesn't depened on
main project
in any way,
p
Should be alright
The gradle DSL in settings, how it looks
a
inside the main project settings.gradle.kts: includeBuild(
github_submodule_project
) // i'm not sure about this
currently_working_on_jvm_module
build.gradle.kts: implementation(project(
kmp_library_with_jvm_target
))
p
Should look something like
Copy code
include(":component") 
 project(":component").projectDir = File("../component/component")
Where the File() has the path relative to the root of your current setting project
a
thank you that made the
component
i want to be included in the main project, but gradle fails to sync because it's saying that the
component
's projects dependecnies could not be found 😕
component
depends on other local gradle projects inside
github submodule project
p
You could potentially keep doing the same. However, I would advise pulling you git submodules in the same directory where you have the main project, as siblings. That way you can have many of them and your main project keep flat. Otherwise, if you use it as child project, it digs deeper in and is harder to follow
In this project I use that technique I described, you can check it out the varied settings.gradle file and build.gradle https://github.com/pablichjenkov/templato/tree/master Ultimately, if it becomes too messy, not optimal but, mavenLocal still an option.
a
Hello, thanks for your solution it's working for me but also this one from this answer works in a more natural way https://stackoverflow.com/questions/12154031/multiple-settings-gradle-files-for-multiple-projects-building/29664571#29664571 just added a file called submodule-settings.gradle.kts which is generic and can be reused multiple times
p
Ah cool, glad you solved the problem. I just checked, really interesting the settings stuff