How to properly turn this jruby command into a gradle task?

Hello, excuse me as a newbie to both gradle and jruby.

I have a jruby command that I am able to run with expected result in Mac OSX:

jruby command below:

jruby -G bin/rake spec

But when I turn this into a gradle task as the below build.gradle, I am getting an error LoadError: no such file to load – bundler/setup

Can someone help me here? Thanks.

build.gradle file below:

buildscript {

repositories { jcenter() }

dependencies {

classpath ‘com.github.jruby-gradle:jruby-gradle-plugin:0.1.9’

} }

import com.github.jrubygradle.JRubyExec

apply plugin: ‘com.github.jruby-gradle.base’

task rakeSpec( type: JRubyExec ) {

jrubyArgs ‘-G’

script ‘bin/rake’

scriptArgs ‘spec’ }

command log below:

$ gradle rakeSpec :rakeSpec LoadError: no such file to load – bundler/setup

require at org/jruby/RubyKernel.java:1065

require at /Users/admin/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.15/4d9cb332bad3633c9c23a720542f456dc0c58a81/jruby-complete-1.7.15.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55

(root) at file:/Users/admin/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.15/4d9cb332bad3633c9c23a720542f456dc0c58a81/jruby-complete-1.7.15.jar!/jruby/bundler/startup.rb:4 :rakeSpec FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:rakeSpec’. > Process ‘command ‘/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java’’ finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 10.433 secs

I found the solution. Problem resolved by adding proper dependencies.

dependencies {

jrubyExec group: ‘rubygems’, name: ‘bundler’, version: ‘1.8.+’

jrubyExec group: ‘rubygems’, name: ‘rake’, version: ‘10.4.+’

jrubyExec group: ‘rubygems’, name: ‘rspec’, version: ‘3.2.+’ }