I'm just starting out. I'm using an open source li...
# getting-started
d
I'm just starting out. I'm using an open source library. Instead of constantly asking the maintainer to make updates and publish them to Maven is there a way that I can build it locally and include it in my project? Would it have to be two separate projects?
not kotlin but kotlin colored 1
x
You keep them as 2 separate projects. If the lib you use uses maven, you can publish it to your local (computer) maven repo with
mvn install
if it's Gradle, use
Copy code
gradle publishToMavenLocal
Then use it like you would normally. I would also recommend to suffix the version with your. So if the lib is 1.2.3, version it 1.2.3-mypatch for instance. Maybe the build gets more complicated than this. If that doesn't work, please give us the repo you're trying to build.
Also don't forget that doing this you will slowly drift away from the main project and may need to merge the changes from the original repo into your fork.
d
Thanks! I'll do some exploration and give that a try.
I plan on forking the repo and submitting pull requests.
👍 3
FYI: The library is called kool, it's an OpenGL/Vulkan graphics engine written in Kotlin (https://github.com/fabmax/kool)
x
This is already a chunky baby :) Just tested:
./gradlew publishToMavenLocal
will give you:
Copy code
❯ ls ~/.m2/repository/de/fabmax/kool/**
/home/you/.m2/repository/de/fabmax/kool/kool-core:
0.12.0-SNAPSHOT  maven-metadata-local.xml

/home/you/.m2/repository/de/fabmax/kool/kool-core-js:
0.12.0-SNAPSHOT  maven-metadata-local.xml

/home/you/.m2/repository/de/fabmax/kool/kool-core-jvm:
0.12.0-SNAPSHOT  maven-metadata-local.xml

/home/you/.m2/repository/de/fabmax/kool/kool-physics:
0.12.0-SNAPSHOT  maven-metadata-local.xml

/home/you/.m2/repository/de/fabmax/kool/kool-physics-js:
0.12.0-SNAPSHOT  maven-metadata-local.xml

/home/you/.m2/repository/de/fabmax/kool/kool-physics-jvm:
0.12.0-SNAPSHOT  maven-metadata-local.xml
Which you can then use with
Copy code
repositories {
  mavenLocal()
}

dependencies {
  implementation("de.fabmax.kool:kool-core-jvm:0.12.0-SNAPSHOT")
}
Have fun
d
I didn't see this but managed to figure it out. Thanks for your help! Didn't know that such a thing as a local maven repo existed. Very handy.
e
mavenLocal has some issues. since kool uses Gradle as a build tool, using it as an included build would be better
run
--include-build ../path/to/kool
to your
./gradlew
invocation or add
includeBuild("../path/to/kool")
inside your
settings.gradle(.kts)
, and Gradle will automatically build and use the local kool instead of the binary, no need to go through the local publication step