https://kotlinlang.org logo
#getting-started
Title
# getting-started
j

Johan Alkstål

01/05/2021, 7:12 AM
If I were to make a Kotlin Library project, how would I later on go about using it in a Kotlin Application project?
m

maaxgr

01/06/2021, 6:39 AM
I publish my libraries to https://jitpack.io/. Then you can import them in other projects via gradle. Here is a relatively small sample project of mine: https://github.com/MaaxGr/KotlinUtils Maybe you want to take a look, how i implemented it, be looking at: • README for usage info • build.gradle for JAR Task that is neccessary to get published on jitpack
j

Johan Alkstål

01/06/2021, 8:21 AM
Thanks! I'll take a look What if I don't want to publish it anywhere and just use it locally?
m

maaxgr

01/06/2021, 8:25 AM
This easiest way would be to build a jar file, put the jar in e.g. a libs folder of your application that wants to use the lib and add the following dependency to build.gradle
Copy code
dependencies {
    implementation files('libs/something_local.jar')
}
j

Johan Alkstål

01/06/2021, 8:25 AM
I see. Thanks for the suggestion