jip 0.1

Tue 04 January 2011
  • 装备 tags:
  • java
  • jip
  • project
  • python published: true comments: true

The original idea is to create a standalone jython environment, I took traditional Java tools, ant and ivy, to resolve Java dependencies. But the XMLs seem to be verbose and not pythonic. So I decide to create something like pip, that is, resolves and installs dependencies in a pythonic way. It is jip.

jip will automatically download jars and its non-optional runtime dependencies from Maven repositories. By default, jip will search your local repository and maven central repository for the requested artifact. Also, you can create a configuration file to overwrite this.

Virtualenv is required by jip. You must run jip within a standalone environment, created by virtualenv: virtualenv -p /usr/local/bin/jython jython-env cd jython-env source bin/activate

Don't forget to activate it.

Then download jip with pip: pip install jip

Now you have pip for python and jip for java. To install a Java package, just type:
jip install <groupId>:<artifactId>:<version>

groupId+artifactId+version is known as the coordinate of a maven artifact. For example, you need spring-core in your jython development: jip install org.springframework:spring-core:3.0.5.RELEASE

The jars will be stored in javalib directory: ls javalib

commons-logging-1.1.1.jar     spring-core-3.0.5.RELEASE.jar
spring-asm-3.0.5.RELEASE.jar

And When you installed jip, I will provide you a jython-all command to include dependencies by default. So use jython-all instead of jython to run your program and the shell.

For traditional Java user, there is a resolve subcommand to download dependencies defined in a pom file. This is more maintainable, some of you may prefer this way to typing it one by one. jip resolve pom.xml

To define custom repositories, place a dot file .jip in your home directory:
[cc lang='ini']
[jboss]
uri=http://repository.jboss.org/maven2/
type=remote

[local]
uri=/home/sun/.m2/repository/
type=local

[central]
uri=http://repo1.maven.org/maven2/
type=remote
[/cc]
You may have internal Nexus, just append to this file following the pattern.

Finally, a clean subcommand to remove everything you downloaded.

That's all. You can find the project at:

Your feedback is appreciate. Fire an issue in github if you find any bugs or new ideas about this tool.