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.
184
162
185
163
.build.gradle
186
164
[source,gradle]
@@ -237,36 +215,6 @@ dependencies {
237
215
NOTE: If the version of Gradle supports the `content` DSL keyword for repositories, only
238
216
requests dependencies with the specific groups will be sent to the GEM repositories.
239
217
240
-
=== Using a custom Gem repository
241
-
242
-
By default the jruby plugin will use
243
-
link:http://rubygems.lasanga.io[rubygems.lasanga.io] as its source of Ruby
244
-
gems. This is a server operated by link:https://github.com/rtyler[R. Tyler
245
-
Croy] and it presents a Maven repository of the data from
246
-
link:https://rubygems.org[rubygems.org].
247
-
248
-
If you **do not** wish to use this repository, you can run your own Maven proxy
249
-
repository for either rubygems.org or your own gem repository by running the
There are still plenty of cases, such as for local development, when you might
@@ -286,3 +234,86 @@ end
286
234
287
235
NOTE: The `.rb` file is assuming it's in the top level of the source tree, i.e.
288
236
where `build.gradle` is located
237
+
238
+
== Upgrading to 2.x from 1.7.x
239
+
240
+
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.
241
+
242
+
=== Default repositories
243
+
244
+
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
245
+
246
+
[source,groovy]
247
+
----
248
+
jruby {
249
+
defaultRepositories = true // <1>
250
+
}
251
+
----
252
+
<1> Adds `ruby.gems()` and `jcenter()`.
253
+
254
+
This functionality is deprecated and will be removed in a future version.
255
+
256
+
=== jrubyExec configuration
257
+
258
+
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
259
+
260
+
[source,groovy]
261
+
----
262
+
configurations {
263
+
jrubyExec
264
+
}
265
+
----
266
+
267
+
and then enable this configuration either globally as your GEM configuration by doing
268
+
269
+
[source,groovy]
270
+
----
271
+
jruby {
272
+
gemConfiguration 'jrubyExec'
273
+
}
274
+
----
275
+
276
+
or on a task-specific basis
277
+
278
+
[source,groovy]
279
+
----
280
+
task myRunner(type: JRubyExec) {
281
+
jruby {
282
+
gemConfiguration 'jrubyExec' // <1>
283
+
}
284
+
}
285
+
----
286
+
<1> Enables configuration only for the given task.
287
+
288
+
NOTE: If you set `gemConfiguration 'jrubyExec'` you will also notice that Gradle creates a `jrubyPrepareJrubyExec` tasks to unpack your GEMs in an isolated area.
289
+
290
+
=== Setting GEM & JAR installation directories
291
+
292
+
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.
293
+
294
+
=== Setting the JRuby version to use
295
+
296
+
`jruby.defaultVersion` is deprecated. Do this rather via
297
+
298
+
[source,groovy]
299
+
----
300
+
jruby {
301
+
jrubyVersion = '9.1.2.3'
302
+
}
303
+
----
304
+
305
+
You can also override the JRuby version a per-task basis.
306
+
307
+
[source,groovy]
308
+
----
309
+
task myRunner(type: JRubyExec) {
310
+
jruby {
311
+
jrubyVersion = '9.1.2.3' // <1>
312
+
}
313
+
}
314
+
----
315
+
<1> Use a different version of JRuby only in a specific task, whilst using a globally configured version for everything else.
316
+
317
+
=== Changing the JRubyExec configuration
318
+
319
+
The `configuration` is deprecated. Use `jruby.gemConfiguration` on the task itself for a custom configuration.
The core plugin is not meant for consumption by build script authors. It is rather targeted at authors of other plugins that might require some core JRuby functionality without the conventional and extensions that is associated with other JRuby-Gradle plugins.
4
+
5
+
This plugin offers the following functionality:
6
+
7
+
* A repository handler extension to resolve GEMs directly from https://rubygems.org or another GEM repository that serves the same REST API.
8
+
* Conversion between GEM-style and Ivy-style dependencies notations.
9
+
* An abstract task class (`AbstractJRubyPrepare`) for preparing local GEM + JAR installations.
0 commit comments