Why no package manager for Kotlin (or java)?


Hello guys,

I’ve just started to learn Kotlin from PHP community with no Java background. I’m trying to find out something like composer in PHP or npm or yarn in NodeJS, those packages dependency management tool in Kotlin (or java, actually I don’t care about java…).
I found a post in StackOverflow, it seems such tool in java world is maven. But I can not figure out what it really does, without saying they use gradle nowadays.
I mean I want a tool:
<Tool> search <keyword> can list me libraries contains <keyword>
<Tool> show <package> can show me the <package> details with versions list
<Tool> install <package>@<version> can check dependencies and install the <package> automatically for the specified <version>

And for now it seems in Java world (Kotlin), I should write down:

dependencies {
    compile "org.jetbrains.anko:anko:$anko_version"

by hand, and try to figure out $anko_version by myself. I don’t see it is wisdom (or maybe I don’t know the convenient way.)

It seems I didn’t get the point.


Sorry, WAT?
Java packaging and dependency management is two orders wuperior to anything you can find for JavaScript (I don’t know about PHP, but I think that situation there is not better). Kotlin mostly uses gradle as a build and dependency management tool (you can also use maven, but it is not recommended if you are not forced to do so).

In Java you do not have local environment where you can install packages, you use packages directly and they are downloaded on-demand, so install action does not make sense. For the rest see maven central.

The example you have shown is taken from gradle build script and version could be ommited. In this case the latest available version will be used, but of course it is not recommended since in that case you can’t control what version you use.


I actually try to understand why there’s the difference. I mean, Ex.:
Ubuntu linux package: apt-get install
Python lib: pip install
Golang lib: go get
PHP lib: composer require
NodeJs lib: npm or yarn add

Maybe because java needs to compile the code. (But then I thought golang also need to do compiling…)
So maybe java has a lot and large libraries? (So that’s why it requires downloaded on-demand)

Not quite sure…


I am not sure where your problem is. If you want to know the build/dependency tool for kotlin, it is gradle. The reason for maven support or just some basic build system in IDEs is simple. Maven is supported to make switching from java possible as a lot of Java projects are build using maven. And basic build systems in IDEs just make sense as it makes it a lot easier for people to learn programming without having to learn an entire build system as well.


I think that that misunderstanding comes from the fact that Java does have dependency management and build system while JS, Python, etc do not.

Just believe me that after java, JS or Python “environment” looks like stone hammer. In gradle/maven you con not only have different dependency versions for different projects, but in fact different transitive dependency versions in the same project. And you do not need to think about “installing” packages at all. Just download the code and the build system manages dependencies itself.


Java/Kotlin get compiled into packages (JARs, WARs, etc.). The build tools, like Gradle, do dependency management. You use versions in dependencies to prevent version updates from breaking your code. When you do a build, your dependencies get downloaded into a shared repository directory (~/.m2/repository by default). When you package up the build for deployment to a server, those dependencies get copied into the package, making it a stand-alone deployment.


I think it’s probably because Kotlin takes itself as wrapper of java or js, and it’s not a script language. As more and more pure Kotlin packages come up, we probably need a package manager. I expect Kotlin could have OS/Platform agnostic packages. It may have platform specific implementations, but from user api perspective, it suppose to be same.


Kotlin utilizes maven/gradle as a package manager. It works quite well for any type of module.