-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I use a locally produced gem in my Gradle build #650
Comments
Hey there, so far we tried to get the gradle jruby to load the development version of asciidoctor-pdf from a local maven or gradle repository/cache, but we weren't successful. Another option would be to locally host the gem with rubygems_servlets, but this feature is undocumented so far. Would it be alright with you if we uploaded the current asciidoctor-pdf dev version to rubygems.org, under our own 'namespace'? e.g. 'vogella-asciidoctor-pdf-dev' |
I would really prefer if you didn't add a development gem to rubygems.org since it will stick around forever and eventually confuse people. There is a way to specify a path to a local directory or file as the gem dependency using the JRuby Gradle plugin. If you figure this out, it will help out a lot of other people who have tried. We can then document it in the Gradle plugin README so we don't forget. |
I figured out how you can do this. It's a bit of a hack because you have to declare the dependencies of the gem explicitly, but it should get the job done for now. First, you need to build the gem locally and store it somewhere.
The gem file can be found under pkg/. We'll need to manipulate the configuration for the JRuby Gradle plugin, so you need to declare it:
In order to use a local gem from Gradle, we have to specify all the dependencies of that gem manually.
Next, override the JRubyPrepare task to use all these dependencies plus the one you built:
Finally, make sure that the asciidoctor task depends on customJRubyPrepare and that it requires asciidoctor-pdf.
You should see that it uses the Asciidoctor PDF gem from your local file system. I'd like to see this supported more easily out of the box in the plugin. |
Thank you very much! |
+1
|
This information is now referenced in the contributing code guide. See https://github.com/asciidoctor/asciidoctor-pdf/blob/master/CONTRIBUTING-CODE.adoc |
@fap- is currently build the Asciidoctor-pdf gem so that we can benefit from not yet released versions.
@mojavelinux describes how to use a released Ruby version of asciidoctor in #572 (comment)
Is it also possible to use a locally produced gem in a Gradle build? We tried to use flatdir but failed and our attempts to put it into the local Gradle cache or .m2 cache were also not successfully.
The text was updated successfully, but these errors were encountered: