Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Ivy

lrenn edited this page · 38 revisions

Testing Ivy Support

Assuming you have a working git checkout of ninjudd/cake:

cake deps
cake killall
git checkout ivy
wget -P lib http://repository.apache.org/content/repositories/staging/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar
cake deps

At this point cake should refetch its dependencies using Ivy. All other cake builds will now use Ivy as well.

New Features

  • :conf - Ivy configurations. Map to Maven scopes when using maven repositories. [foo "1.0.0+" :conf "master"] foo "1.0.0+" :conf "devel->master"

  • :transitive true/false - Resolve transitively or not (pull down just that modules artifacts, or that modules artifacts and all of it's dependencies artifacts). [foo "1.0.0+" :transitive false]

  • latest.integration/latest.release revisions. [foo "latest.integration"] [bar "latest.release"] You can then publish foo or bar with --status=integration or --status=release and the latest revision of that status will always be used.

  • publish - The equivalent of a Maven install. Supports the same options as the ivy:publish ant task.

  • branches - In addition to revisions, dependencies can also have a branch. You can publish a module to a branch by passing --pubbranch=foo to publish then use it as a dependency with :branch.

    # In project scratch cake jar cake publish --pubbranch=foo # add [scratch "latest.integration" :branch "foo"] to itch's project.clj # In project itch cake deps # itch gets the foo branch version of scratch. This can also be combined with configurations.

  • Offline Mode - Add cake.java_opts = -Divy.cache.ttl.default=eternal to ~/.cake/config and as long as you've already run deps once before, you'll be able to clean and run deps as much as you want without a network connection to any maven repositories. This can also be used to speed up builds since it won't make any networks connections at all. When we get a config task this will be toggled with cake config offline=true.

  • Shared Repositories - You change the default shared repository path by adding cake.java_opts = -Divy.shared.default.root=<some path> to ~/.cake/config. This allows a development team to easily share a single repository.

  • deps-report - Will generate an html report of all dependencies. Also supports dot, graphml, and other formats. It supports all same options as the ivy:report ant task.

    • A sample html ivy report can be viewed here.
    • Graphiz can be used to create dependency graphs: cake deps-report --dot=true && dot -ocake.png -Tpng build/reports/ivy/cake-cake-default.dot Which will result in an image such as this one.
  • Non-Maven/Non-Ivy Dependencies - Need to add a jar to your project but it's not in Maven or Ivy? Just copy the jar to ~/.ivy2/local/<org>/<module>/<revision>/jars/<module>.jar. It can then be included in your project.clj as [org module "revision"], or if you used the same org and module name [module "revision"].

  • install-module - Will install a module from one repository to another. Default --from=public and --to=local cake install-module --organisation=org.apache.ivy --module=ivy --revision=2.2.0-rc1 Supports all the same options as the ivy:install ant task. Note that local versions are always used if found. So if you have a dependency with 1.0.0+ and you have it installed locally as 1.0.1 but maven as a 1.0.2 you'll use 1.0.1.

  • clean-cache - Cleans the ivy cache of all modules. This is roughly equivelent to rm -rf ~/.m2 for maven users but deletes the ivy.cache.dir instead.

  • force revision - By specifying :force "true" in a dependency you can stop conflict managers from evicting old revisions.

  • changing modules - By specifying :changing "true" you can have ivy ignore the cache for this particular dependency.

  • :ivysettings "path/to/ivysettings.xml" - You can specify your own ivysettings file. Note that the default clojure and clojars repositories are not automatically added when supplying a custom ivysettings file. In addition, any :repositories in project.clj will be added to an ivy chain named "default".

  • custom configurations - See ivy configurations. The format of this key needs some serious work. As of now, default and devel are required and map to lib and lib/dev. They're still useful for specifying alternate dependencies list. For example, something like ring could have a jetty and tomcat configuration, pulling down only the dependencies for the adapter you plan on using.

:configurations {:default-mapping "default->default"
                 "default" {}
                 "compile" {:extends "default" :description "Compile time dependencies."}
                 "runtime" {:extends "compile" :description "Runtime dependencies."}
                 "devel"   {:visibility "private"}}
  • multiple artifacts - See ivy publications. Like configurations, I need a better format for this key.
:publications {:default-conf "master,default"
               "itch"       {:type "jar"}
               "itch-jetty" {:type "jar" conf="jetty"}}
  • Icing - Icing is a way to automatically load the external dependencies for a .clj file before running it. It is the Clojure equivalent to Groovy's Grape. See the Icing wiki page for more details.

TODO

  • Add LICENCE as an artifact if it exists (name and url are already supported). This can be achieved manually with the :publications key.
  • Some way to use the configurations for more than publishing dependencies and artifacts. Contexts? --classpath=?
  • Better way to pass org/module/revision to install and other tasks. org/module/revision perhaps.
  • ivy:buildnumber for auto incrementing revision.
  • Exclude clojure and clojure-contrib from :dev-dependencies? This is what cake does now. I understand the problem it's solving, but I wonder if there is a better way. Technically, a devel configuration would include clojure and clojure-contrib just as default does.
  • [DONE] Add :artifacts key to project.clj? It should probably have one. No everyone produces just a single jar.
  • [DONE] Support classifiers.
  • [DONE] Currently there are only 3 configurations (master, compile, devel). Support custom configurations. and maybe add testing, runtime, etc, to the defaults.
  • [DONE] Handle licenses. The project.clj :license keys are correctly handled and added to the ivy.xml, but the LICENSE itself is not listed as an artifact nor is it published. Need to write out an artifact node to the ivy.xml for it.
  • [DONE] Branch support. In addition to revisions, Ivy can support a branch attribute (very handy).
  • [DONE] Parse options for publish. Currently you can only publish locally. Only the resolver name needs to be parsed.
  • [DONE] Ability to specify ivy settings.
  • [DONE] ivy:report task support. Gives a nice report of dependencies and where they come from.
  • [DONE] ivy:install so you can install 3rd party dependencies locally.
  • [DONE] "Cache only" if you don't have a network.

  • About 100 other things Ivy can do.

Something went wrong with that request. Please try again.