• Stars
    star
    211
  • Rank 186,867 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

bundler support for jars for jruby

jbundler

  • Build Status

Manage jar dependencies similar to how bundler manages gem dependencies:

  • the DSL mimics the one from bundler
  • you can use maven-like version declarations or rubygems/bundler version ranges
  • it locks down the jar versions inside "Jarfile.lock"
  • you can declare jar dependencies within a gem using the requirements directive of the gem specification. jbundler will include those jar dependencies into its classpath

differences compared to bundler

  • you need to run bundle install first if any of the gems have jar dependencies.
  • all one command jbundle, see jbundle help on the possible options and how to update a single jar, etc.

Get started

Install JBundler with:

jruby -S gem install jbundler

First, create a Jarfile, something like:

jar 'org.yaml:snakeyaml', '1.14'
jar 'org.slf4j:slf4j-simple', '>1.1'

Install jar dependencies

jruby -S jbundle install

Loading the jar files

require 'jbundler'

It will add all the jar dependencies in the java classpath from the Jarfile.lock.

Jarfile

More info about the Jarfile and about versions.

For adding a maven repository see Jarfile.

Building the jbundler gem

Running the integration test

./mvnw verify
./mvnw clean verify

or a single integration test

./mvnw verify -Dinvoker.test=running_rspec_via_rake
./mvnw clean verify -Dinvoker.test=running_rspec_via_rake

Building the gem (see ./pkg)

./mvnw package -Dinvoker.skip

Or just

gem build jbundler.gemspec

Usage

Here is an example usage of the AliasEvent class from the snakeyaml package

#test_file.rb
require 'jbundler'
require 'java'

java_import 'org.yaml.snakeyaml.events.AliasEvent'

class TestClass
  def my_method
    puts AliasEvent.methods
  end
end

TestClass.new.my_method

Limitations

Since the version resolution happens in two steps - first the gems, and then the jars/poms - it is possible in case of a failure that there is a valid gems/jars version resolution which satisfies all version contraints. So there is plenty of space for improvements (like maven could resolve the gems as well, etc).

Special thanks

The whole project actually started with a controversial discussion on a pull request on bundler. This very same pull request were the starting point of that project here. Probably by now there is not much left of the original code, but many thanks to ANithian for giving the seed of that project.

License

Almost all code is under the MIT license but the java class (AetherSettings.java)[https://github.com/mkristian/jbundler/blob/master/src/main/java/jbundler/AetherSettings.java] which was derived from EPL licensed code.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Meta-fu

enjoy :)

More Repositories

1

jar-dependencies

manage jar dependencies for ruby gems
Ruby
35
star
2

ruby-maven

repo moved to
Ruby
28
star
3

dm-ldap-adapter

ldap-adapter for datamapper
Ruby
19
star
4

rack_datamapper

rack plugins for datamapper
Ruby
14
star
5

rails-resty-gwt

bring gwt and rails together with the help of restygwt
Java
13
star
6

datamapper4rails

utils for using datamapper (datamapper.org) with rails: model generators, session store , restful transactions, restful adapter
Ruby
9
star
7

cuba-api

add content negogiation, serialization of objects (their attributes map), and some helpers for authentication + authorization to the cuba framework
Ruby
9
star
8

cuba-rest

building rest api-server with cuba
Ruby
7
star
9

jetty-run

running a rack or rails applicaton with jetty servlet engine (when app does run with jruby)
Ruby
5
star
10

kristians_rails_plugins

share my private rails plugins: fuzzy-search, datanmapper-session-store, idle-session-timeouts, etc
Ruby
5
star
11

slf4r

Slf4r provides a uniform interface for instantiating und using of a logger. but the actual logging is done by some third party logging framework.
Java
5
star
12

ixtlan

a framework on top rails to write application with a central usermanagement (signle sign on, restful webservices)
Ruby
4
star
13

fake_blood

Ruby ORM benchmark
Ruby
3
star
14

dm-lucene-adapter

a datamapper adapter for the search engine lucene for jruby only
Ruby
3
star
15

examples

demonstrate maven multi module setup with rails using rails3-maven-plugin
Ruby
2
star
16

war-pack

pack a warfile for rack based projects using ruby-maven
Ruby
2
star
17

sahyadri

simple tool for the school library of sahyadri school
Ruby
2
star
18

ixtlan-session-timeout

idle session timeout for rails on per controller base
Ruby
2
star
19

ixtlan-generators

rails generator templates for ixtlan gems
Ruby
1
star
20

ixtlan-users

manage users and their groups and associations of their groups
Java
1
star
21

fractals

fractals using padic number systems (and maybe higher dimensional mandelbrot-sets in future)
Java
1
star
22

ixtlan-error-handler

dump errors on filesystem and notify developers
Ruby
1
star
23

dhammapada

api server for dhammapada translations
Ruby
1
star
24

webfortune

fortune like gwt library which select a random "quote" from given set and displays it
Java
1
star
25

ixtlan-audit

audit the rails controller action of a logged in user keeping privacy issue in
Ruby
1
star
26

ixtlan-guard

simple authorization framework for rails3
Ruby
1
star
27

rails-roo

inspired by spring roo which allows to manage models and their views
Ruby
1
star
28

ixtlan-core

cache header control, dynamic configuration, and rails generator templates
Ruby
1
star
29

ixtlan-babel

offers json/xml/yaml serialization of POROs and filtering for hashes
Ruby
1
star
30

rideboards

little application to manage rideboards
Ruby
1
star
31

ixtlan-optimistic

optimistic find/get on model via updated_at timestamp for datamapper and activerecord
Ruby
1
star
32

ruby-maven-demo

demo on how to create gems with java extensions
Ruby
1
star