jar-dependencies 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 274254447873346a5b24169b315650e12c70dccf
4
- data.tar.gz: e3418380915ae02feea4b997f6539b4535a02a55
3
+ metadata.gz: 18e0d621bcb8e41bb7e4ff42801952483a29f42b
4
+ data.tar.gz: fd330a66fa69ddc0f84cf0fef25f0f3ffad21caa
5
5
  SHA512:
6
- metadata.gz: 4cad596f0105b5040517669ec3557c5c3b9fcaca600a42ffffd5a908446a6fe919566c652a55d82b327c780b0f6b37396484672f1531334e42b71f3136b36327
7
- data.tar.gz: aff2bca76dddc1919217f7b2c53eef971d42b548de8ba7945635e3a340b1b5fedb99b19569f4d318c22f290e78b6e30545677622a4261ebf3c0a9cf7056a9a71
6
+ metadata.gz: cfa381d4c43fe3464fc9bf730ed6666b3c17f4e24c0e40e7d96a57b5eb82352f3f2d4c49591bf9036dc66ece232c4d1a376c44e5b37d2aa8c9d7bf93fed49492
7
+ data.tar.gz: 2589fe23b38231268b2436d1261a71173384b822c797cbbdc0fc62c9edfc245ec32538fc6de21319be6c29587e051e6ffa5b814ed472b1b3da4af591c6511c08
data/Readme.md CHANGED
@@ -94,9 +94,59 @@ an [example with rspec and all](example/Readme.md) walks you through setup and
94
94
  shows how development works and shows what happens during installation.
95
95
 
96
96
  there are some more examples with the various [project setups for gems and application](examples/README.md).
97
- this includes using proper Maven for the project or **ruby-maven** with rake or
97
+ this includes using proper Maven for the project or ruby-maven with rake or
98
98
  the rake-compiler in conjuction with jar-dependencies.
99
99
 
100
+ # lock down versions #
101
+
102
+ whenever there are version ranges for jar dependencies then it is advisable to lock down the versions of dependecies. for the jar dependencies inside the gemspec declaration this can be done with:
103
+
104
+ lock_jars
105
+
106
+ this is also working in **any** project which uses a gem with
107
+ jar-dependencies. it also uses a Jarfile if present. see the [sinatra
108
+ application from the examples](examples/sinatra-app/having-jarfile-and-gems-with-jar-dependencies/).
109
+
110
+ this means for project using bundler and jar-dependencies the setup is
111
+
112
+ bundle install
113
+ lock_jars
114
+
115
+ which will install both gems and jars for the project.
116
+
117
+ update a specific version is done with (use only the artifact_id)
118
+
119
+ lock_jars --update slf4j-api
120
+
121
+ and look at the dependencies tree
122
+
123
+ lock_jars --tree
124
+
125
+ as ```lock_jars``` uses ruby-maven to resolve the jar dependencies.
126
+ since jar-dependencies does not declare ruby-maven as runtime dependency
127
+ (you just not need ruby-maven during runtime only when you want to
128
+ setup the project it is needed) it is advicable to have it as
129
+ development dependency in you Gemfile.
130
+
131
+ # gradle, maven, etc
132
+
133
+ for dependency management frameworks like gradle (via
134
+ jruby-gradle-plugin) or maven (via jruby-maven-plugins
135
+ or jruby9-maven-plugins) or probably ivy or sbt can use the gem
136
+ artifacts from a maven repository like
137
+ [rubygems-proxy from torquebox](http://rubygems-proxy.torquebox.org/)
138
+ or
139
+ [rubygems.lasagna.io/proxy/maven/releases](http://rubygems.lasagna.io/proxy/maven/releases/).
140
+
141
+ each of these tools (including jar-dependencies) does the dependency
142
+ resolution slightly different and in rare cases can produce different
143
+ outcomes. but overall each tool can manage both jars and gems and
144
+ their transitive dependencies.
145
+
146
+ popular gems like jrjackson or nokogiri do not declare their jars in
147
+ the gemspec files and just load the bundle jars into jruby
148
+ classloader, can easily create problems as the jackson and
149
+ xalan/xerces libraries used by those gems are popular ones in the java world.
100
150
 
101
151
  # configuration #
102
152
 
@@ -210,5 +210,13 @@ module Jars
210
210
  def [](index)
211
211
  @artifacts[index]
212
212
  end
213
+
214
+ def each(&block)
215
+ @artifacts.each(&block)
216
+ end
217
+
218
+ def size
219
+ @artifacts.size
220
+ end
213
221
  end
214
222
  end
@@ -49,17 +49,22 @@ module Jars
49
49
  # if gemspec is local then include all dependencies
50
50
  maven.attach_jars( spec, cwd == spec.full_gem_path )
51
51
  end
52
- rescue Gem::LoadError => e
53
- # not sure why to reraise the exception
54
- raise e
55
- rescue LoadError => e
56
- if Jars.verbose?
57
- warn e.message
58
- warn "no bundler found - ignore Gemfile if exists"
52
+ rescue Exception => e
53
+ case e.class.to_s
54
+ when 'LoadError'
55
+ if Jars.verbose?
56
+ warn e.message
57
+ warn "no bundler found - ignore Gemfile if exists"
58
+ end
59
+ when 'Bundler::GemfileNotFound'
60
+ # do nothing then as we have bundler but no Gemfile
61
+ when 'Bundler::GemNotFound'
62
+ warn "can not setup bundler with #{Bundler.default_lockfile}"
63
+ raise e
64
+ else
65
+ # reraise exception so user sees it
66
+ raise e
59
67
  end
60
- rescue Bundler::GemNotFound => e
61
- warn "can not setup bundler with #{Bundler.default_lockfile}"
62
- raise e
63
68
  ensure
64
69
  $LOAD_PATH.replace( load_path )
65
70
  end
@@ -1,6 +1,8 @@
1
1
  # this file is maven DSL
2
2
 
3
- model.dependencies.each do |d|
4
- puts " " + d.group_id + ':' + d.artifact_id + (d.classifier ? ":" + d.classifier : "" ) + ":" + d.version + ':' + (d.scope || 'compile')
5
- puts " exclusions: " + d.exclusions.collect{ |e| e.group_id + ':' + e.artifact_id }.join unless d.exclusions.empty?
3
+ if ENV_JAVA['jars.quiet'] != 'true'
4
+ model.dependencies.each do |d|
5
+ puts " " + d.group_id + ':' + d.artifact_id + (d.classifier ? ":" + d.classifier : "" ) + ":" + d.version + ':' + (d.scope || 'compile')
6
+ puts " exclusions: " + d.exclusions.collect{ |e| e.group_id + ':' + e.artifact_id }.join unless d.exclusions.empty?
7
+ end
6
8
  end
data/lib/jars/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Jars
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  JRUBY_PLUGINS_VERSION = '1.1.3'.freeze
4
4
  DEPENDENCY_PLUGIN_VERSION = '2.8'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jar-dependencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian meier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-29 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement