运行 Ruby 的脚本使用 Gradle

Run a Ruby's script using Gradle

我在 Gradle 中使用 Jruby 到 运行 我的脚本,但它给我这个错误:

Error:(16, 0) Gradle DSL method not found: 'jrubyExec()' Possible causes:

  • The project 'AppBusiness' may be using a version of Gradle that does not contain the method. Gradle settings
  • The build file may be missing a Gradle plugin.

  • 这是我的build.gradle

    apply plugin: "com.github.jruby-gradle.base"
    
    import com.**github**.jrubygradle.JRubyExec   --This github is red
    task printSomePrettyOutputPlease(type: JRubyExec) {
    description "Execute our nice local print-script.rb"
    script "print-script.rb"
    } 
    

    答案是 gradle 的版本较旧,更新 gradle 后问题解决了。