rammpeter / jarbler

MIT License
5 stars 2 forks source link

Misformatted jruby version #16

Closed atakanyenel closed 12 hours ago

atakanyenel commented 5 days ago

This is the error I'm getting when running on nixOs without java or jruby. That machine is just my development env. The rails project is very greenfield so far with o specific requirements:

Jarbler release 0.3.0, 2024-06-16 ( https://github.com/rammpeter/jarbler )

No configuration file found at /home/user/rails2/memories/config/jarble.rb. Using default values.
Used configuration values are:
  excludes:                 ["tmp/cache", "tmp/pids", "tmp/sockets", "vendor/bundle", "vendor/cache", "vendor/ruby"]
  executable:               bin/rails
  executable_params:        ["server", "-e", "production", "-p", "8080"]
  includes:                 ["app", "bin", "config", "config.ru", "db", "Gemfile", "Gemfile.lock", "lib", "log", "public", "Rakefile", "script", "vendor", "tmp"]
  jar_name:                 memories.jar
  jruby_version:            .1.5

Error: Illformed requirement [".1.5"]
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:107:in `parse'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `block in initialize'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `map!'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `initialize'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:69:in `new'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:69:in `create'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency.rb:57:in `initialize'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:310:in `new'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:310:in `resolve_dependencies'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:227:in `install'
/home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler/builder.rb:213:in `copy_jruby_jars_to_staging'
rammpeter commented 5 days ago

Could you please execute the failing command again with environment setting "DEBUG=true" and send the output.

rammpeter commented 4 days ago

A quick workaround for the problem would be to create a file 'config/jarble.rb' with a fixed release value for JRuby.

Jarbler::Config.new do |config|
  config.jruby_version = '9.4.7.0'
end

Nevertheless, it would be nice to investigate the root cause of the wrong release number using DEBUG=TRUE.

atakanyenel commented 4 days ago

Looks like the error is coming from this line: https://github.com/rammpeter/jarbler/blob/cabeac3393011cb3b9f943f36de447a89afe5724/lib/jarbler/config.rb#L122

My .ruby-version file content is ruby-3.1.5. Looks like the line above is reading one more line more and only takes .1.5.

Nevertheless, here is the debug output.

rails2-5611917:~/rails2/memories{jarble}$ DEBUG=true bundle exec jarble

Jarbler release 0.3.0, 2024-06-16 ( https://github.com/rammpeter/jarbler )
Running with Ruby version '3.1.5' on platform 'x86_64-linux'. Engine 'ruby' version '3.1.5'
Project dir: /home/user/rails2/memories
JRuby version from .ruby-version file: .1.5

No configuration file found at /home/user/rails2/memories/config/jarble.rb. Using default values.
Used configuration values are:
  excludes:                 ["tmp/cache", "tmp/pids", "tmp/sockets", "vendor/bundle", "vendor/cache", "vendor/ruby"]
  executable:               bin/rails
  executable_params:        ["server", "-e", "production", "-p", "8080"]
  includes:                 ["app", "bin", "config", "config.ru", "db", "Gemfile", "Gemfile.lock", "lib", "log", "public", "Rakefile", "script", "vendor", "tmp"]
  jar_name:                 memories.jar
  jruby_version:            .1.5

Config attributes:
@compile_ruby_files: false
@excludes: ["tmp/cache", "tmp/pids", "tmp/sockets", "vendor/bundle", "vendor/cache", "vendor/ruby"]
@excludes_from_compile: []
@executable: bin/rails
@executable_params: ["server", "-e", "production", "-p", "8080"]
@includes: ["app", "bin", "config", "config.ru", "db", "Gemfile", "Gemfile.lock", "lib", "log", "public", "Rakefile", "script", "vendor", "tmp"]
@jar_name: memories.jar
@jruby_version: .1.5

Error: Illformed requirement [".1.5"]
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:107:in `parse'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `block in initialize'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `map!'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `initialize'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:69:in `new'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:69:in `create'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency.rb:57:in `initialize'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:310:in `new'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:310:in `resolve_dependencies'
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:227:in `install'
/home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler/builder.rb:213:in `copy_jruby_jars_to_staging'
/home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler/builder.rb:21:in `build_jar'
/home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler.rb:17:in `run'
/home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/bin/jarble:8:in `<top (required)>'
/home/user/.local/share/gem/ruby/3.1.0/bin/jarble:25:in `load'
/home/user/.local/share/gem/ruby/3.1.0/bin/jarble:25:in `<top (required)>'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `load'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `kernel_load'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:23:in `run'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli.rb:451:in `exec'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli.rb:34:in `dispatch'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli.rb:28:in `start'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/exe/bundle:28:in `block in <top (required)>'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/exe/bundle:20:in `<top (required)>'
/usr/bin/bundle:25:in `load'
/usr/bin/bundle:25:in `<main>'
Temporary directory /tmp/d20240626-1644-yswswe not removed because of debug mode
bundler: failed to load command: jarble (/home/user/.local/share/gem/ruby/3.1.0/bin/jarble)
/nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:107:in `parse': Illformed requirement [".1.5"] (Gem::Requirement::BadRequirementError)
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `block in initialize'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `map!'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:139:in `initialize'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:69:in `new'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/requirement.rb:69:in `create'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency.rb:57:in `initialize'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:310:in `new'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:310:in `resolve_dependencies'
        from /nix/store/0g0gw1gjlnczl0crk0s93w2mgcr0fpgx-ruby-3.1.5/lib/ruby/3.1.0/rubygems/dependency_installer.rb:227:in `install'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler/builder.rb:213:in `copy_jruby_jars_to_staging'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler/builder.rb:21:in `build_jar'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/lib/jarbler.rb:17:in `run'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/jarbler-0.3.0/bin/jarble:8:in `<top (required)>'
        from /home/user/.local/share/gem/ruby/3.1.0/bin/jarble:25:in `load'
        from /home/user/.local/share/gem/ruby/3.1.0/bin/jarble:25:in `<top (required)>'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `load'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli/exec.rb:23:in `run'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli.rb:451:in `exec'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli.rb:34:in `dispatch'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/cli.rb:28:in `start'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/exe/bundle:28:in `block in <top (required)>'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /home/user/.local/share/gem/ruby/3.1.0/gems/bundler-2.5.9/exe/bundle:20:in `<top (required)>'
        from /usr/bin/bundle:25:in `load'
        from /usr/bin/bundle:25:in `<main>'
atakanyenel commented 4 days ago

The error here goes away when I use the default jruby version 9.2.3.0 instead of 9.4.7.0.


Okay, when I do the config file manually, it works. Then I do java jar memories.jar but it says: Your Ruby version is 3.1.4, but your Gemfile specified 3.1.5

My ruby --version also says 3.1.5, so I don't know where this 3.1.4 is coming from, but I'm investigating. This might be related to my own env.

rammpeter commented 4 days ago

To avoid such errors like mismatch of Ruby versions it could be a good approach to build the Gemfile.lock of the app again by running "bundle install" in the same JRuby environment (release) like later used for jarble.