Skip to content

Commit

Permalink
Merge pull request #87 from ecdemis123/master
Browse files Browse the repository at this point in the history
Readme Updates
  • Loading branch information
mkristian authored May 21, 2018
2 parents 6769774 + c914415 commit 08f19e1
Showing 1 changed file with 39 additions and 21 deletions.
60 changes: 39 additions & 21 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ differences compared to **bundler**
## Get started

Install JBundler with:

jruby -S gem install jbundler
```bash
jruby -S gem install jbundler
```

First, create a **Jarfile**, something like:

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

Install jar dependencies

jruby -S jbundle install
```bash
jruby -S jbundle install
```

Loading the jar files

require 'jbundler'
```bash
require 'jbundler'
```

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

Expand All @@ -41,35 +45,49 @@ More info about the **[Jarfile](https://github.com/torquebox/maven-tools/wiki/Ja

For adding a maven repository see [Jarfile](https://github.com/torquebox/maven-tools/wiki/Jarfile).

# Building the jbundler gem
## Building the jbundler gem

Running the integration test

./mvnw verify
```bash
./mvnw verify
```

Building the gem (see ./pkg)

./mvnw package -Dinvoker.skip
```bash
./mvnw package -Dinvoker.skip
```

Or just
```bash
gem build jbundler.gemspec
```

## Usage

gem build jbundler.gemspec
Here is an example usage of the AliasEvent class from the snakeyaml package

## Example
```ruby
#test_file.rb
require 'jbundler'
require 'java'

*src/example/my_project* has a Gemfile which uses a gem which depends on jar dependency. See *src/example/gem_with_jar/gem_with_jar.gemspec* how the jar gets declared.
java_import 'org.yaml.snakeyaml.events.AliasEvent'

Execute *src/example/my_project/info.rb* to see it in action:
class TestClass
def my_method
puts AliasEvent.methods
end
end

cd src/example/my_project
jbundle install
bundle exec info.rb
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
## Special thanks

The whole project actually started with a controversial discussion on a [pull request on bundler](https://github.com/carlhuda/bundler/pull/1683). 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](https://github.com/ANithian) for giving the seed of that project.

Expand Down

0 comments on commit 08f19e1

Please sign in to comment.