Is there a package manager for Java like easy_inst

2019-03-07 18:40发布

问题:

Is there a package manager for Java like easy_install for Python ?
I'm looking for a solution usable from the command line and not from an IDE.

回答1:

Maven does provide dependency management based on remote repositories (like the central repo) that are browsable, searchable.

Maven Ant Tasks (retired) use Maven's repositories to provide dependency management and more to Ant builds.

Ant Ivy is another alternative to Maven Ant Tasks.

MOP is another command line tool that leverages Maven's repository and dependencies.



回答2:

Edit 2017-04-27: I have been disappointed by the lack of forward momentum for jpm4j, and the lack of community-centric development. So I invented a new tool called jrun. I invite everyone to check it out. It has a narrower scope than tools like Python's pip, but it does let you execute Java code from remote Maven repositories in an easy-to-use manner.


Check out JPM4J. It is a project by Peter Kriens (of BND fame). He first proposed it last year, and as of this writing it has been around for a few months and is looking pretty impressive.

It was inspired by Node's npm, and like that tool, installation is a cinch:

OS X:

local   $ curl http://www.jpm4j.org/install/local  | sh
global  $ curl http://www.jpm4j.org/install/global | sudo sh

Linux:

curl http://www.jpm4j.org/install/script | sh

And Windows has a clicky installer, of course.

Then you install stuff similarly to other command-line package manager tools. E.g.:

jpm install org.codehaus.groovy:groovy-all

The install command operates Maven coordinates. Basically, the JAR just needs a JPM-Command entry in its manifest, and jpm knows how to expose its main class as a command-line executable.

Personally I would really love to see the Java community get behind an effort like this. A really solid Java package manager is years overdue!



回答3:

Ivy from Apache is the closest thing I know of.