0

我确实在 Jruby+swing 中完成了一个小型桌面应用程序。现在我想部署它。我发现 rawr 是从非 Web 应用程序构建 jar 的最佳选择。但是当我尝试从 Jruby 项目构建 jar 时,出现“ rake aborted!private method `move' called for File:Class ”错误。

这是来自 cmd promet 的完整跟踪:

E:\NETBEANS\KeyingClient_jruby\lib>rake rawr:jar --trace
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/zip/zip.rb:28: Use RbConfi
g instead of obsolete and deprecated Config.
** Invoke rawr:jar (first_time)
** Invoke rawr:compile (first_time)
** Invoke rawr:compile_java_classes (first_time)
** Invoke rawr:prepare (first_time)
** Invoke rawr:load_configuration (first_time)
** Execute rawr:load_configuration
** Execute rawr:prepare
** Execute rawr:compile_java_classes
** Invoke rawr:compile_ruby_classes (first_time)
** Invoke rawr:prepare
** Execute rawr:compile_ruby_classes
** Invoke rawr:copy_other_file_in_source_dirs (first_time)
** Invoke rawr:prepare
** Execute rawr:copy_other_file_in_source_dirs
** Execute rawr:compile
** Invoke rawr:build_data_jars (first_time)
** Invoke rawr:prepare
** Execute rawr:build_data_jars
** Execute rawr:jar
=== Creating jar file: E:/NETBEANS/KeyingClient_jruby/lib/package/jar/KeyingClie
nt.jar
rake aborted!
private method `move' called for File:Class
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/zip/zip.rb:1570:in `on_suc
cess_replace'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/zip/zip.rb:1478:in `commit
'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/zip/zip.rb:1493:in `close'

c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/zip/zip.rb:1385:in `open'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/jar_builder.rb:40:in `buil
d'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rawr-1.2/lib/rawr.rb:171:in `(root)'
org/jruby/RubyProc.java:249:in `call'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `e
xecute'
org/jruby/RubyArray.java:1612:in `each'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `e
xecute'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `i
nvoke_with_call_chain'
c:/jruby-1.7.0/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `i
nvoke_with_call_chain'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `i
nvoke'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:11
6:in `invoke_task'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:94
:in `top_level'
org/jruby/RubyArray.java:1612:in `each'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:94
:in `top_level'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:13
3:in `standard_exception_handling'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:88
:in `top_level'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:66
:in `run'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:13
3:in `standard_exception_handling'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:63
:in `run'
c:/jruby-1.7.0/lib/ruby/gems/shared/gems/rake-0.9.2.2/bin/rake:33:in `(root)'
org/jruby/RubyKernel.java:1045:in `load'
c:/jruby-1.7.0/bin/rake:23:in `(root)'
Tasks: TOP => rawr:jar

我正在使用“rake rawr:jar”进行构建,我的 jruby 版本是 1.7.0。

任何人都可以告诉我出了什么问题...

预先感谢。

4

1 回答 1

2

File.move似乎已在 Ruby 1.9.x 中删除。这可能是 rawr 中的一个错误。File.rename应该是一个不错的选择。

我相信该move功能已被淘汰,因为它无法跨文件系统移动内容,并且在尝试进行此类操作时会导致大量错误。大多数人不会测试这类东西,因此当它影响到试图在具有不同分区的系统上使用它的人时,它通常会产生问题。

rename方法采用了一种不同的、更可靠的方法,并将根据需要进行复制。

于 2012-11-14T06:22:57.797 回答