# multiplatform


10/08/2023, 5:34 PM
Hello, everyone. Does anyone here have a good example of how to have multiple modules in a KMM project? I'm looking at this project, but I'm finding everything so confusing: Thanks!


10/08/2023, 6:01 PM
gradle modules are great way to split your project into parts: • to create a new module create a new directory in your gradle project root dir, or other module dir, let's say we named the directory "Foo", after that we need to tell gradle that, this directory is actually a module, in settings.gradle.kts(there can only be one per project), add a line `include(":Foo")`that will include the module Foo in your gradle project, you can also use
The difference is that, if you put the colon, at the start of string, when referencing a module, then you need to provide a path, from the root of the project, and if you don't use the colon, then you are choosing a module, that's in the current module dir So ":Foo", will point to the Foo module from the root And "Foo" will point to the Foo module in the current module Each module can have its own build.gradle.kts. If you want to use a module in some other module use
Where you can replace implementation with api, or ":Foo" with any other module path by current module i mean, let's say we have structure like this root ⤷Foo ⤷Bar if we have an build.gradle.kts in Foo for ex. then we can reference Bar there in two ways 1. "Bar" 2. "FooBar"