JRuby Example Plugin
This is an example Alassian plugin using JRuby and Java.
The plugin shows:
- How to embed the JRuby runtime (via the JRuby Embed API),
- How to execute Ruby scripts that are part of the plugin
- How to set variables from Java to be used in Ruby scripts
- How to work with the output of Ruby scripts
- How to automatically install and bundle Ruby libraries (RubyGems)
This plugin is for demonstration purposes. Hence it is incomplete and not production ready.
Make sure that you have installed the Atlassian Plugin SDK and that the various
atlas-* commands are available on your
Clone the repository and start Confluence from within the plugin project
The first time this command is executed, the required RubyGem libraries will be
automatically downloaded and copied to the
The Maven project is set up to copy the Ruby scripts in
The list of RubyGems is defined in the
required.gems property. Feel free to
change this list to add the RubyGems you need for your own implementation.
<required.gems>sinatra jruby-rack rio nokogiri</required.gems>
After updating the list, the new RubyGems can be downloaded by running:
mvn -Prubygems process-resources
Note: The build process creates an index file
META-INF/gemspec.index that is used
ScriptingContainerProviderImpl to correctly set the Ruby
so that all the RubyGems can be read from the classpath.
At the moment the Ruby tests need to be run manually (they are not executed as part of the Maven build yet).
jruby available on your
PATH run (see http://jruby.org/getting-started to get started):
jruby -S bundle install jruby -S rake test