You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
software to help proxy a Rubygem repository into a Maven repository format.
52
-
This ensures that Gradle can resolve gem-based dependencies. _Currently_ the
53
-
plugin release on link:http://rubygems.lasagna.io/proxy/maven/releases[a
54
-
Rubygems Maven proxy] operated by link:https://github.com/rtyler[R. Tyler
55
-
Croy]
41
+
NOTE: This functionality relies on an internal proxy which converts information from https://rubygems.org in to an Ivy repository service. this functionality is enabled by adding `ruby.gems()` to the `repositories` block. If you have a running Maven GEMs proxy you may use that too.
56
42
57
43
== Tasks
58
44
@@ -89,16 +75,7 @@ Common methods for `JRubyExec` for executing a script
89
75
* `standardOutput` - `OutputStream`. Capture the output of the script.
90
76
* `errorOutput` - `OutputStream`. Capture the error output of the script.
91
77
* `ignoreExitValue` - `Boolean`. Ignore the JVm exit value. Exit values are only effective if the exit value of the Ruby script is correctly communicated back to the JVM.
92
-
* `configuration` - `String`. Configuration to copy gems from. (*)
93
-
* `classpath` - `List`. Additional Jars/Directories to place on classpath.
94
-
* `jrubyVersion` - `String`. JRuby version to use if not the same as ```project.jruby.execVersion```.
95
-
* `gemWorkDir` - `File`. Provide a custom working directory for unpacking GEMs. By default each `JRubyExec` task
96
-
uses it's own work directory. Use this to set a common work directory for a number of tasks.
97
-
98
-
(*) If `jrubyVersion` has not been set, `jrubyExec` will used as configuration.
99
-
However, if `jrubyVersion` has been set, a configuration must also be provded
100
-
to maintain dependency isolation, see
101
-
link:http://jruby-gradle.org/errors/jrubyexec-version-conflict/[this page] for more details.
78
+
* `jruby` - `JRubyPluginExtension`. Allows to override settigns from the global `jruby` extension.
102
79
103
80
Additional `JRubyExec` methods for controlling the JVM instance
104
81
@@ -135,11 +112,8 @@ task needSomeRubyLove {
135
112
136
113
The behaviour of `project.jrubyexec` is slightly different to that of `JRubyExec`.
137
114
138
-
* The version of `jruby-complete` is strictly tied to the `jruby.execVersion`. Therefore trying to set `jrubyVersion`
139
-
in the ```jrubyexec``` closure will cause a failure
140
-
* GEMs and additional JARs are only taken from the `jrubyExec` configuration.
141
-
* It is not possible to supply a `configuration` parameter to the `jrubyexec` closure.
142
-
* GEMs will be installed to `jruby.gemInstallDir`. Existing gems will not be overwritten.
115
+
* The version of JRuby is strictly tied to the global `jruby.jrubyVersion`.
116
+
* GEMs and additional JARs are only taken from the `jruby.gemConfiguration` configuration.
143
117
144
118
As with `JRubyExec`, `args`, `setArgs` and `main` are illegal within the `jrubyexec` closure.
Unpacking occurs using the default `jruby` version as set by `jruby.execVersion`.
157
+
Unpacking occurs using the default JRuby version as set by `jruby.jrubyVersion`. This can be overridden within the task itself if required.
158
+
159
+
In most cases you do not have to do anything. The JRubyPrepare task will be created for you and associated with the appropriate configuration. If you customise configurations or use different configurations for different tasks, Gradle will useually create appropriate `JRubyPrepare` tasks for you and link the appropriate task dependencies.
160
+
161
+
You can also create your own custom `JRubyPrepare` tasks if required.
As of version 1.1.0, the JRuby/Gradle base plugin supports embedding a
208
-
link:https://github.com/torquebox/rubygems-servlets[rubygems-servlets] process
209
-
*inside* the Gradle process itself. This obviates the need for a third-party
185
+
As of version 2.0, the JRuby/Gradle base plugin supports embedding a lightweight proxy inside* the Gradle process itself. This obviates the need for a third-party
210
186
proxy to present the Maven-compatible dependency information that JRuby/Gradle
211
-
relies on.
187
+
relies on and it also supercedes the older link:https://github.com/torquebox/rubygems-servlets[rubygems-servlets] process
<3> Retrieve GEMS from another server and associated a custom group name with that server.
213
+
<4> Enabled the legacy Torquebox Maven proxy. Please note that this proxy server is unmaintained upstream and may lead to brittle builds in some cases.
214
+
<5> Retrieve a GEM. `rubygems` is the default group for GEMs.
215
+
<6> Retrieve a GEM using a custom group.
230
216
231
-
=== Using a custom Gem repository
232
-
233
-
By default the jruby plugin will use
234
-
link:http://rubygems.lasanga.io[rubygems.lasanga.io] as its source of Ruby
235
-
gems. This is a server operated by link:https://github.com/rtyler[R. Tyler
236
-
Croy] and it presents a Maven repository of the data from
237
-
link:https://rubygems.org[rubygems.org].
238
-
239
-
If you **do not** wish to use this repository, you can run your own Maven proxy
240
-
repository for either rubygems.org or your own gem repository by running the
NOTE: If the version of Gradle supports the `content` DSL keyword for repositories, only
218
+
requests dependencies with the specific groups will be sent to the GEM repositories.
260
219
261
220
=== Using the JRuby/Gradle without Gradle
262
221
@@ -277,3 +236,86 @@ end
277
236
278
237
NOTE: The `.rb` file is assuming it's in the top level of the source tree, i.e.
279
238
where `build.gradle` is located
239
+
240
+
== Upgrading to 2.x from 1.7.x
241
+
242
+
If you are already using the base proxy for work, upgrading will yield a number of surprises. Hopefully they will come as nice wow factors once you have changed your build file.
243
+
244
+
=== Default repositories
245
+
246
+
Repositories are no longer added by default. You should explictly declare which repositories you require. If you still need the old behaviour, you can obtain that by
247
+
248
+
[source,groovy]
249
+
----
250
+
jruby {
251
+
defaultRepositories = true // <1>
252
+
}
253
+
----
254
+
<1> Adds `ruby.gems()` and `jcenter()`.
255
+
256
+
This functionality is deprecated and will be removed in a future version.
257
+
258
+
=== jrubyExec configuration
259
+
260
+
The `jrubyExec` configuration is no longer added as the GEM configuration handling has been cleaned up and much improved in 2.x. If you have a number of instances relying on `jrubyExec` you can do
261
+
262
+
[source,groovy]
263
+
----
264
+
configurations {
265
+
jrubyExec
266
+
}
267
+
----
268
+
269
+
and then enable this configuration either globally as your GEM configuration by doing
270
+
271
+
[source,groovy]
272
+
----
273
+
jruby {
274
+
gemConfiguration 'jrubyExec'
275
+
}
276
+
----
277
+
278
+
or on a task-specific basis
279
+
280
+
[source,groovy]
281
+
----
282
+
task myRunner(type: JRubyExec) {
283
+
jruby {
284
+
gemConfiguration 'jrubyExec' // <1>
285
+
}
286
+
}
287
+
----
288
+
<1> Enables configuration only for the given task.
289
+
290
+
NOTE: If you set `gemConfiguration 'jrubyExec'` you will also notice that Gradle creates a `jrubyPrepareJrubyExec` tasks to unpack your GEMs in an isolated area.
291
+
292
+
=== Setting GEM & JAR installation directories
293
+
294
+
This behaviour was already deprecated in 1.7.x and has now been removed. Directories are now associated with specific configuration names. For the `gems` configuration this is in `${buildDir}/.gems`. For other configurations it will be a different directory. You can obtain the directory, via the `JRubyPrepare.getOutputDir()` method.
295
+
296
+
=== Setting the JRuby version to use
297
+
298
+
`jruby.defaultVersion` is deprecated. Do this rather via
299
+
300
+
[source,groovy]
301
+
----
302
+
jruby {
303
+
jrubyVersion = '9.1.2.3'
304
+
}
305
+
----
306
+
307
+
You can also override the JRuby version a per-task basis.
308
+
309
+
[source,groovy]
310
+
----
311
+
task myRunner(type: JRubyExec) {
312
+
jruby {
313
+
jrubyVersion = '9.1.2.3' // <1>
314
+
}
315
+
}
316
+
----
317
+
<1> Use a different version of JRuby only in a specific task, whilst using a globally configured version for everything else.
318
+
319
+
=== Changing the JRubyExec configuration
320
+
321
+
The `configuration` is deprecated. Use `jruby.gemConfiguration` on the task itself for a custom configuration.
0 commit comments