Skip to content

Commit 2de59c7

Browse files
authored
Merge pull request #96 from chadlwilson/tidy-links-readme
Correct links; tidy README; test with JRuby 10
2 parents f35b9f7 + 74fcab9 commit 2de59c7

5 files changed

Lines changed: 54 additions & 49 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
ruby-version: [jruby-9.3, jruby-9.4]
16+
ruby-version: [jruby-9.3, jruby-9.4, jruby-10.0]
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v5
2020
- name: Set up Ruby
2121
uses: ruby/setup-ruby@v1
2222
with:

.rubocop.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Performance/Casecmp:
1818

1919
Style/Alias:
2020
EnforcedStyle: prefer_alias_method
21-
Style/BlockDelimiters:
22-
IgnoredMethods: []
2321
Style/Documentation:
2422
Enabled: false
2523
Style/EnvHome:

Readme.md

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# jar-dependencies
22

3-
* [![Build Status](https://secure.travis-ci.org/mkristian/jar-dependencies.svg)](http://travis-ci.org/mkristian/jar-dependencies)
4-
* [![Code Climate](https://codeclimate.com/github/mkristian/jar-dependencies.svg)](https://codeclimate.com/github/mkristian/jar-dependencies)
5-
6-
add gem dependencies for jar files to ruby gems.
3+
[![Gem Version](https://img.shields.io/gem/v/jar-dependencies)](https://rubygems.org/gems/jar-dependencies)
4+
[![Build Status](https://github.com/jruby/jar-dependencies/actions/workflows/main.yml/badge.svg)](https://github.com/jruby/jar-dependencies/actions/workflows/main.yml?query=branch%3Amaster)
75

6+
Add gem dependencies for jar files to ruby gems.
87

98
## Getting control back over your jar
109

1110
jar dependencies are declared in the gemspec of the gem using the same notation
12-
as <https://github.com/mkristian/jbundler>.
11+
as [JBundler](https://github.com/jruby/jbundler).
1312

1413
When using `require_jar` to load the jar into JRuby's classloader a version conflict
1514
will be detected and only **ONE** jar gets loaded.
@@ -23,10 +22,12 @@ In such cases **jbundler** can always **overwrite** any such version.
2322

2423
Add the following to your *Rakefile*:
2524

26-
require 'jars/installer'
27-
task :install_jars do
28-
Jars::Installer.vendor_jars!
29-
end
25+
```ruby
26+
require 'jars/installer'
27+
task :install_jars do
28+
Jars::Installer.vendor_jars!
29+
end
30+
```
3031

3132
This will install (download) the dependent jars into **JARS_HOME** and create a
3233
file **lib/my_gem_jars.rb**, which will be an enumeration of `require_jars`
@@ -62,7 +63,9 @@ gem so the require_jars file will be overwritten during installation with the
6263

6364
Set the environment variable
6465

65-
export JARS_VENDOR=false
66+
```shell
67+
export JARS_VENDOR=false
68+
```
6669

6770
to tell the jar_installer not vendor any jars, but only create the file with the
6871
`require_jar` statements. This `require_jars` method will find the jar inside the
@@ -102,28 +105,36 @@ the rake-compiler in conjunction with jar-dependencies.
102105
Whenever there are version ranges for jar dependencies it is advisable to lock down the versions of dependencies.
103106
For the jar dependencies inside the gemspec declaration this can be done with:
104107

105-
lock_jars
108+
```shell
109+
lock_jars
110+
```
106111

107112
This is also working in **any** project which uses a gem with
108113
jar-dependencies. It also uses a Jarfile if present. See the [sinatra
109114
application from the examples](examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/).
110115

111116
This means for a project using bundler and jar-dependencies the setup is
112117

113-
bundle install
114-
lock_jars
118+
```shell
119+
bundle install
120+
lock_jars
121+
```
115122

116123
This will install both gems and jars for the project.
117124

118125
Update a specific version is done with (use only the artifact_id)
119126

120-
lock_jars --update slf4j-api
127+
```shell
128+
lock_jars --update slf4j-api
129+
```
121130

122131
And look at the dependencies tree
123132

124-
lock_jars --tree
133+
```shell
134+
lock_jars --tree
135+
```
125136

126-
As ```lock_jars``` uses ruby-maven to resolve the jar dependencies.
137+
As `lock_jars` uses ruby-maven to resolve the jar dependencies.
127138
Since jar-dependencies does not declare ruby-maven as runtime dependency
128139
(you just not need ruby-maven during runtime only when you want to
129140
setup the project it is needed) it is advicable to have it as
@@ -141,13 +152,7 @@ jar-dependencies itself uses maven **only** for the jars and all gems are manage
141152

142153
# Gradle, Maven, etc
143154

144-
For dependency management frameworks like gradle (via
145-
jruby-gradle-plugin) or maven (via jruby-maven-plugins
146-
or jruby9-maven-plugins) or probably ivy or sbt can use the gem
147-
artifacts from a maven repository like
148-
[rubygems-proxy from torquebox](http://rubygems-proxy.torquebox.org/)
149-
or
150-
[rubygems.lasagna.io/proxy/maven/releases](http://rubygems.lasagna.io/proxy/maven/releases/).
155+
Dependency management frameworks like gradle (via jruby-gradle-plugin) or maven (via jruby-maven-plugins) can also use gem artifacts retrieved from rubygems.org.
151156

152157
Each of these tools (including jar-dependencies) does the dependency
153158
resolution slightly different and in rare cases can produce different
@@ -164,18 +169,23 @@ xalan/xerces libraries used by those gems are popular ones in the Java world.
164169
Since maven is used under the hood it is possible to get more insight
165170
what maven is doing. Show the regular maven output:
166171

167-
JARS_VERBOSE=true bundle install
168-
JARS_VERBOSE=true gem install some_gem
172+
```shell
173+
JARS_VERBOSE=true bundle install
174+
JARS_VERBOSE=true gem install some_gem
175+
```
176+
169177

170178
Or, with maven debug enabled
171179

172-
JARS_DEBUG=true bundle install
173-
JARS_DEBUG=true gem install some_gem
180+
```shell
181+
JARS_DEBUG=true bundle install
182+
JARS_DEBUG=true gem install some_gem
183+
```
174184

175185
The maven command line which gets printed needs maven-3.9.x and the
176186
ruby DSL extension for maven:
177-
[https://github.com/takari/polyglot-maven#configuration](polyglot-maven
178-
configuration) where ```${maven.multiModuleProjectDirectory}``` is
187+
[polyglot-maven
188+
configuration](https://github.com/takari/polyglot-maven#configuration) where `${maven.multiModuleProjectDirectory}` is
179189
your current directory.
180190

181191
# Configuration
@@ -206,15 +216,12 @@ your current directory.
206216

207217
# Motivation
208218

209-
Just today, I stumbled across [https://github.com/arrigonialberto86/ruby-band](https://github.com/arrigonialberto86/ruby-band) which uses jbundler to manage their JAR dependencies, which happens on the first 'require "ruby-band"'. There is no easy or formal way to find out which JARs are added to jruby-classloader.
210-
211-
Another issue was brought to my notice yesterday [https://github.com/hqmq/derelicte/issues/1](https://github.com/hqmq/derelicte/issues/1).
212-
213-
Or the question of how to manage JRuby projects with maven [http://ruby.11.x6.nabble.com/Maven-dependency-management-td4996934.html](http://ruby.11.x6.nabble.com/Maven-dependency-management-td4996934.html)
214-
215-
Or a few days ago an issue for rake-compile [https://github.com/luislavena/rake-compiler/issues/87](https://github.com/luislavena/rake-compiler/issues/87)
219+
In 2014, while tools such as [https://github.com/arrigonialberto86/ruby-band](https://github.com/arrigonialberto86/ruby-band) used [jbundler](https://github.com/jruby/jbundler) to manage their there was no easy or formal way to
220+
- find out which JARs were added to the JRuby classloader
221+
- to manage JRuby projects with Maven
222+
- to build Java/JRuby gem extensions with [rake-compiler](https://github.com/luislavena/rake-compiler/issues/87).
216223

217-
With JRuby 9000 it is the right time to get jar dependencies "right" - the current situation is like the time before bundler for gems.
224+
With JRuby 9000 it was the right time to get jar dependencies "right".
218225

219226
# Developing
220227

examples/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ from the jar-dependencies plugin.
4040

4141
## gem with jar dependencies
4242

43-
see the project here: [gem with jar dependencies](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-jar-dependencies)
43+
see the project here: [gem with jar dependencies](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-jar-dependencies)
4444

4545
you need to use bundler in this example. just declare the jar
4646
dependencies inside the gemspec, run
@@ -66,7 +66,7 @@ extension. note that there is no jar-dependencies gem involved here.
6666
### using maven
6767

6868
see project here:
69-
[gem with java extension using maven](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-java-extension/using-maven)
69+
[gem with java extension using maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension/using-maven)
7070

7171
you need maven 3.9.x installed to get it working and the project needs
7272
to prepare maven to use the ruby DSL for maven. this is done by adding
@@ -82,7 +82,7 @@ to setup your project.
8282
### using ruby-maven
8383

8484
see project here:
85-
[gem with java extension using ruby-maven](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-java-extension/using-ruby-maven)
85+
[gem with java extension using ruby-maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension/using-ruby-maven)
8686

8787
use the ruby-maven gem instead of system installed maven. much more ruby
8888
like, no need to have anything installed on the system beside jruby, i.e.
@@ -97,7 +97,7 @@ to setup your project.
9797
### using rake-compiler
9898

9999
see project here:
100-
[gem with java extension using rake-compiler](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-java-extension/using-rake-compiler)
100+
[gem with java extension using rake-compiler](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension/using-rake-compiler)
101101

102102
just use the rake compiler inside the Rakefile, i.e.
103103

@@ -117,7 +117,7 @@ examples uses the jar dependencies declaration from the gemspec file.
117117
### using maven
118118

119119
see project here:
120-
[gem with java extension and jar dependencies using maven](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-maven)
120+
[gem with java extension and jar dependencies using maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-maven)
121121

122122
maven just sets up the compile classpath for building the extension jar
123123

@@ -132,7 +132,7 @@ mvn prepare-package
132132
### using ruby-maven
133133

134134
see project here:
135-
[gem with java extension and jar dependencies using ruby-maven](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven)
135+
[gem with java extension and jar dependencies using ruby-maven](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-ruby-maven)
136136

137137
like maven but using ruby-maven instrad.
138138

@@ -147,7 +147,7 @@ rake compile
147147
### using rake-compiler
148148

149149
see project here:
150-
[gem with java extension and jar dependencies using rake-compiler](https://github.com/mkristian/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler)
150+
[gem with java extension and jar dependencies using rake-compiler](https://github.com/jruby/jar-dependencies/tree/master/examples/gem-with-java-extension-and-jar-dependencies/using-rake-compiler)
151151

152152
jar-dependencies gems offers a simple way to pass on the classpath to rake-compiler.
153153

jar-dependencies.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
1010
s.author = 'christian meier'
1111
s.email = ['mkristian@web.de']
1212
s.summary = 'manage jar dependencies for gems'
13-
s.homepage = 'https://github.com/mkristian/jar-dependencies'
13+
s.homepage = 'https://github.com/jruby/jar-dependencies'
1414

1515
s.bindir = 'exe'
1616
s.executables = [lock_jars = 'lock_jars']

0 commit comments

Comments
 (0)