how can I use `implementation project(":module")` ...
# announcements
m
how can I use
implementation project(":module")
in kotlin build script
c
Just add parenthesis,
implementation
is a function
m
That works for third-party libraries I want to import my own module
j
it is the same
m
I just used
implementation(":module")
but doesn't work
g
but doesn’t work
Because you removed “project”, check link by Clovis, it includes correct declaration
Copy code
implementation(project(":module"))
m
here is my project structure
g
??
m
Copy code
implementation(project(":instagram4j"))
g
okay, it looks right
m
but it doesn't work too
g
what kind error do you have?
m
Copy code
Could not resolve project :instagram4j.
Required by:
    project :
g
looks that you have some issue in project structure, hard to say What looks strange, that both of those projects are in different directories, which in case of Gradle may work, but only with additional configuration
g
yep, it looks like the case, when you just added 2 projects to Idea, without adding them to the same Gradle project, in this case, as Ryan suggested, composite build is way to go
c
Did you add the project in
settings.gradle.kts
?
m
yes I did
c
Oh, good eyes @gildor. That's probably it
g
Hard to say without any additional information, your original question was about “kotlin build script” but it hardly related on this, it’s not about syntax, it’s about your project structure
m
yes you are right, when I found the syntax then the real problem shows up
Actually I imported project from github that is a gradle java module to my own project that is gradle kotlin module too
g
You really don’t want to just add another Gradle project just as one more module in your settings.gradle, it probably will not work, because it essentially changes whole structure of another project What you really want is to use composite builds for this
c
When you import someone else's project, do it from MavenCentral or similar, don't clone the repo. It's much, much easier.
m
Actually I want to modify it
p
Then an included build is probably the best fit on quick iterations.
Well even better would be to merge your changes upstream 😉
m
I tried @Ryan Simon & @gildor suggestions and it works like a charm
thank you buddies
@Paul Woitaschek that's just a test, not worth to create a PR