Piotr Gabryanczyk’s Blog

Java, Refactoring, AOP, Spring, DDD, TDD, etc.

  • Blogroll

    • I have joined Anti-IF Campaign

Archive for September, 2010

How to resolve java dependency from the command line without maven

Posted by Piotr Gabryanczyk on September 26, 2010


I want to be able to download java library and it’s dependencies using simple command-line tool i.e.
ivy.sh resolve jetty jetty 5.1.10


  • Download Ivy. Ivy understands maven repositories and can do the job for you.
  • Create a script ivy.sh in ivy installation directory with the following content:

    cd=`dirname $0`
    if [ "$1" == "resolve" ]; then
            echo "Resolving $1 $2 $3"
            java -jar $cd/ivy-2.2.0-rc1.jar -retrieve ./[artifact]-[revision]-[type].[ext] -dependency $*

  • Make your script executable:
    chmod a+x ivy.sh
  • Add it to the path ie. ~/.bash_profile
    export PATH=$PATH:/where/you/have/ivy.sh


Posted in Uncategorized | 1 Comment »