Skip to content

Commit

Permalink
updated example
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Apr 12, 2014
1 parent f54b2ba commit 06fe111
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.jar
*.jar
*_jars.rb
11 changes: 8 additions & 3 deletions example/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@

rake build

this will install the jar dependencies, compile the java files and build the jar of the gem and build the gem.
this will install the jar dependencies, compile the java files and build the jar of the gem, generates *_jars.rb file which requires all the dependent jars and build the gem.

now install the gem

gem install -l pkg/example-2.gem

on installing that gem the dependent jars get vendored (not the jar extension which is part of the gem itself).
during installation the dependent jars get vendored (not the jar extension which is part of the gem itself).

if you look into the gem itself it just contains the following files:

.
├── example.gemspec
├── lib
│ ├── example.jar
│ ├── example_jars.rb
│ └── example.rb
└── Rakefile

Expand Down Expand Up @@ -43,7 +46,7 @@ in order to use the jar dependencies for development you need to run

which builds the **lib/example.jar** as well the **lib/example_jars.rb**. the latter will add the jar dependencies to jruby's runtime.

the **lib/example_jars.rb** for development looks different from the installed version. development uses the jar dependencies from the local maven repository (**$HOME/.m2/repository**). the installed gem vendors those jars and adjust the **lib/example_jars.rb** to use the vendored jars.
the **lib/example_jars.rb** for development looks different from the installed version. development uses the jar dependencies from the local maven repository (defaults to **$HOME/.m2/repository**). the installed gem vendors those jars and adjust the **lib/example_jars.rb** to use the vendored jars.

in case you do not want to vendor your jars during installation, then you can set the environment **export JRUBY\_JARS\_VENDOR=false**. then the installed files look exactly like the development files.

Expand All @@ -58,3 +61,5 @@ or via the installed gem
gives:

BouncyCastle Security Provider v1.49

with the environmen **JARS\_HOME** you can control the location of the local maven repository or use the **$HOME/.m2/settings.xml** to setup a custom local repository (the maven way). if you vendor the jars on install then the local maven repository is just cache for those jars, if you do not vendor the jars, **jar\_dependencies** will use the jars directly from the local repository.
4 changes: 2 additions & 2 deletions example/example.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Gem::Specification.new do |s|
s.summary = 'gem with jar'
s.description = 'gem with empty jar and jar dependencies'

s.files << Dir[ 'lib/**/*.rb' ].reject{ |d| d == 'lib/example_jars.rb' }
s.files << Dir[ 'lib/**/*.rb' ]
s.files << 'lib/example.jar'
s.files << Dir[ '*file' ]
s.files << 'example.gemspec'

s.add_runtime_dependency 'jar-dependencies', '~>0.0.2'
s.add_runtime_dependency 'jar-dependencies', '~>0.0.3'

s.requirements << "jar org.bouncycastle:bcpkix-jdk15on, 1.49"
s.requirements << "jar org.bouncycastle:bcprov-jdk15on, 1.49"
Expand Down
4 changes: 0 additions & 4 deletions example/lib/example_jars.rb

This file was deleted.

0 comments on commit 06fe111

Please sign in to comment.