rubyjams (draft)

mkristian edited this page Sep 24, 2012 · 3 revisions

jam = jar + gem =

the idea to bring support for jar dependencies to jruby, these dependencies will be called jams.


assuming gem is the jruby gem command

 gem install rubyjams


since all jams are maven jar artifacts the configurations allow to use most of the maven infrastructure (mirrors, profiles, etc) as well just forget about maven and let the defaults work for you. the version declaraton of jams can use both both rubygems like versions as well maven like versions/version-ranges.

installing gems with jams dependencies

gem install any_gem

gem install any_gem --version 123

in case the any_gem depends on a jam it will install jar and its transitive dependencies.

installing jams directly

gem install any_group_id:any_artifact_id --version my_version

this will install any_group_id:any_artifact_id from maven central unless t is already installed.

version is compulsory for jams.

using jams

require 'rubygems'
require 'rubyjams'

whenever require 'something' activates a new gem then all its dependent jams will be added to the jruby classloader. whenever there is a version conflict with a already loaded jams (or jar) then an error gets raised.

load a jam directly through:

jam 'org.apache.solr:solr-core'

declaring jams dependencies

jams can have both maven lke versions as well the usual rubygems like versions - see conversion of rubygems versions to maven version ranges.

TO BE WRITTEN - scope, classifier. pom (dep without jar)/jar(runtime)/jar-developement(development, i.e. test)


there are some configurations possible. either via yaml file in $HOME/.jamrc and/or .jamrc or via environment variables or via java system properties.

ENV java property .jamrc - yaml default value description
JAM_LOCAL_REPOSITORY jam.local_repository local_repository uses the on from settings.xml maven local repository where the jars and poms are stored
JAM_SETTINGS jam.settings settings $HOME/settings.xml maven settings lke local repository, mirrors and profiles with remote repositories
JAM_PROFILES jam.profiles profiles none activate on of the profiles from the settings.xml
JAM_VERBOSE jam.verbose verbose false more output

NOTE if you set the localrepository on a per project base (directly or via settings) then be aware that installing jams results in downloads. (repository manager like nexus or artifactory can help reduce net-traffic for such case)