"Unable to parse rubocopy response" 将自定义 java 程序加载到 jruby 时 Intellij 出错
"Unable to parse rubocopy response" error in Intellij when loading a custom java program into jruby
在 Intellij
中创建了一个 jruby
项目和一个小的 java
模块来构建 "hello world" java 程序,该程序将由 jruby
模块。构建 jrubyjava
模块后,我们可以看到 jruby_hello.rb
是 "happy",jdk
- 来自 java.util.TreeSet
和自定义 类 来自 com.example.[CallMe, ISpeaker]
可访问 jruby_hello.rb
脚本:
但是 - 当 运行 jruby
代码出现以下错误:
这是 rubocop
响应:
Error:jruby.jar is /usr/local/opt/jruby/libexec/lib/jruby.jar
{"metadata":{"rubocop_version":"0.79.0","ruby_engine":"jruby","ruby_version":"2.5.7","ruby_patchlevel":"0","ruby_platform":"java"},"files":[{"path":"jruby_hello.rb","offenses":[{"severity":"convention","message":"Missing magic comment # frozen_string_literal: true
.","cop_name":"Style/FrozenStringLiteralComment","corrected":false,"correctable":true,"location":{"start_line":1,"start_column":1,"last_line":1,"last_column":1,"length":1,"line":1,"column":1}},{"severity":"convention","message":"Prefer single-quoted strings when you don't need string interpolation or special symbols.","cop_name":"Style/StringLiterals","corrected":false,"correctable":true,"location":{"start_line":1,"start_column":9,"last_line":1,"last_column":14,"length":6,"line":1,"column":9}},{"severity":"convention","message":"Prefer single-quoted strings when you don't need string interpolation or special symbols.","cop_name":"Style/StringLiterals","corrected":false,"correctable":true ...
我们可以注意到隐藏在错误输出中的是
"message":"Missing magic comment `# frozen_string_literal: true`."
解决这个问题需要什么?
在文件顶部添加该字符串似乎已经解决了问题
# frozen_string_literal: true
require "java"
在 Intellij
中创建了一个 jruby
项目和一个小的 java
模块来构建 "hello world" java 程序,该程序将由 jruby
模块。构建 jrubyjava
模块后,我们可以看到 jruby_hello.rb
是 "happy",jdk
- 来自 java.util.TreeSet
和自定义 类 来自 com.example.[CallMe, ISpeaker]
可访问 jruby_hello.rb
脚本:
但是 - 当 运行 jruby
代码出现以下错误:
这是 rubocop
响应:
Error:jruby.jar is /usr/local/opt/jruby/libexec/lib/jruby.jar {"metadata":{"rubocop_version":"0.79.0","ruby_engine":"jruby","ruby_version":"2.5.7","ruby_patchlevel":"0","ruby_platform":"java"},"files":[{"path":"jruby_hello.rb","offenses":[{"severity":"convention","message":"Missing magic comment
# frozen_string_literal: true
.","cop_name":"Style/FrozenStringLiteralComment","corrected":false,"correctable":true,"location":{"start_line":1,"start_column":1,"last_line":1,"last_column":1,"length":1,"line":1,"column":1}},{"severity":"convention","message":"Prefer single-quoted strings when you don't need string interpolation or special symbols.","cop_name":"Style/StringLiterals","corrected":false,"correctable":true,"location":{"start_line":1,"start_column":9,"last_line":1,"last_column":14,"length":6,"line":1,"column":9}},{"severity":"convention","message":"Prefer single-quoted strings when you don't need string interpolation or special symbols.","cop_name":"Style/StringLiterals","corrected":false,"correctable":true ...
我们可以注意到隐藏在错误输出中的是
"message":"Missing magic comment `# frozen_string_literal: true`."
解决这个问题需要什么?
在文件顶部添加该字符串似乎已经解决了问题
# frozen_string_literal: true
require "java"