diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 00000000..704b057f --- /dev/null +++ b/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_VERSION: "system" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0df1a1a..a4cbdac7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,34 @@ on: jobs: ci: + name: ${{ matrix.task }} ${{ matrix.ruby-version }} / java@${{ matrix.java-version }} / jruby-rack@${{ matrix.jruby-rack-version }} runs-on: ubuntu-latest strategy: matrix: - java-version: [8, 21, 25] - ruby-version: [jruby-9.4, jruby-10.0, jruby-10.1] task: ['', integration] + java-version: [8, 17, 21, 25] + ruby-version: [jruby-9.4, jruby-10.0, jruby-10.1] + jruby-rack-version: ['1.2', '1.3', '2.0'] exclude: - ruby-version: jruby-10.0 # JRuby 10 requires Java 21 minimum java-version: 8 - ruby-version: jruby-10.1 # JRuby 10 requires Java 21 minimum java-version: 8 + - ruby-version: jruby-10.0 # JRuby 10 requires Java 21 minimum + java-version: 17 + - ruby-version: jruby-10.1 # JRuby 10 requires Java 21 minimum + java-version: 17 + - task: 'integration' # War integration tests require Java 17 + java-version: 8 + - jruby-rack-version: '1.3' # No need to vary jruby-rack version for non-integration + task: '' + - jruby-rack-version: '2.0' # No need to vary jruby-rack version for non-integration + task: '' + - jruby-rack-version: '1.3' # JRuby-Rack 1.3+ requires JRuby 10 + ruby-version: jruby-9.4 + - jruby-rack-version: '2.0' # JRuby-Rack 1.3+ requires JRuby 10 + ruby-version: jruby-9.4 fail-fast: false @@ -54,4 +70,4 @@ jobs: run: BUNDLE_JOBS=1 bundle install - name: Run tests - run: bundle exec rake ${{ matrix.task }} + run: bundle exec rake ${{ matrix.task }} "JRUBY_RACK_VERSION='[${{ matrix.jruby-rack-version }},${{ matrix.jruby-rack-version }}.99999)'" diff --git a/.gitignore b/.gitignore index 619554af..c28ec59d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ !spec/rails7_stub/Gemfile.lock *.sqlite3-* +!.bundle/config .bundle .idea .polyglot.Mavenfile diff --git a/Mavenfile b/Mavenfile index 2cb2b530..2f3e1597 100644 --- a/Mavenfile +++ b/Mavenfile @@ -10,13 +10,12 @@ properties( 'project.build.sourceEncoding' => 'UTF-8', 'mavengem.wagon.version' => '2.0.3', 'jruby.plugins.version' => '3.0.6', - 'jetty.version' => '9.4.58.v20250814', + 'jruby-rack.version' => '[1.2,1.2.99999)', ) # dependencies needed for compilation scope :provided do jar 'org.jruby:jruby', '${jruby.version}' - jar 'org.eclipse.jetty:jetty-webapp', '${jetty.version}' end plugin :clean, '3.5.0' @@ -27,18 +26,19 @@ plugin :jar, '3.5.0' do end plugin :install, '3.1.4' -gem 'bundler', '${bundler.version}' +gem 'bundler', Bundler::VERSION gem 'jruby-jars', '${jruby.version}' +gem 'jruby-rack', '${jruby-rack.version}' plugin :invoker, '3.10.1' do execute_goals( :install, :run, :id => 'integration-test', :properties => { + 'jruby.plugins.version' => '${jruby.plugins.version}', 'warbler.version' => '${project.version}', 'jruby.version' => '${jruby.version}', - 'jetty.version' => '${jetty.version}', - 'bundler.version' => '${bundler.version}', - 'jruby.plugins.version' => '${jruby.plugins.version}', + 'jruby-rack.version' => '${jruby-rack.version}', + 'java.ee.version' => '${java.ee.version}', 'style.color' => 'always', }, :goals => ['verify'], diff --git a/README.rdoc b/README.rdoc index d4f68ef6..dec58910 100644 --- a/README.rdoc +++ b/README.rdoc @@ -12,14 +12,11 @@ Ruby applications to assemble and Just Work. Warbler Status JRuby Java JRuby-Rack Rails Notes ------- ---------- ---------- ---- ---------- --------- ---------------------------------------------- - 2.1 Maintained 9.4 → 10.1 8+ 1.2 → 1.3 5.0 → 8.0 Rails 8.1 may be OK with pure Ruby webservers. + 2.1 Maintained 9.4 → 10.1 8+ 1.2 → 2.0 5.0 → 8.0 Rails 8.1 may be OK with pure Ruby webservers. 2.0 EOL 9.2 → 9.3 6+ 1.1 → 1.2 → 6.1 1.4 EOL 1.1 → 1.7 5+ ? ? -For running wars with specific Java web servers, consult jruby-rack compatibility ( -{master}[https://github.com/jruby/jruby-rack/tree/master], -{1.2-stable}[https://github.com/jruby/jruby-rack/tree/1.2-stable], -{1.1-stable}[https://github.com/jruby/jruby-rack/tree/1.1-stable] ). +For running wars with specific Java web servers, consult {jruby-rack compatibility}[https://github.com/jruby/jruby-rack#compatibility]. == Getting Started @@ -256,10 +253,33 @@ task to give you more insight into what's going on. If you think you found a bug, please file one at https://github.com/jruby/warbler/issues. -=== Common issues with executable wars +=== Common issues with wars If your app isn't working or starting up correctly: +- Jruby-Rack version not compatible with JRuby version + jruby-rack-2.0.0 requires Ruby version >= 3.4.0. The current ruby version is 3.1.7. + jruby-rack-1.3.0 requires Ruby version >= 3.4.0. The current ruby version is 3.1.7. + Warbler is compatible with multiple JRuby-Rack versions which have different JRuby requirements. You are trying to use + a jruby-rack version which does not support your JRuby version; without using bundler to resolve dependencies. + - Consult {jruby-rack compatibility}[https://github.com/jruby/jruby-rack#compatibility] for intended target jruby-rack version + - Use a bundler `:development` group to install warbler, and ensure bundler is running with your intended runtime + JRuby version so the jruby-rack dependency is resolved correctly. + +- Rack version compatibility + An exception happened during JRuby-Rack startup + no such file to load -- rack/chunked + You are trying to use Rack 3.x with a jruby-rack version that does not yet support Rack 3. Try upgrading to a compatible + jruby-rack version, or lock rack at a compatibile version with gem 'rack', '~> 2.2.0'. Note that Rack `2.2` requires Rails < `8.1`. + +- Rack missing at runtime + org.jruby.exceptions.LoadError: (LoadError) cannot load such file -- rack + JRuby-Rack no longer vendors Rack - make sure the rack gem is available to the application (e.g. add it to the Gemfile or install it into the gem path) + You are trying to use JRuby-Rack 1.3+, without a bundle or gem path that resolves an appropriate Rack version via the + `jruby-rack` gem's runtime dependency. Try one of (with appropriate rack version): + - Bundler: add gem 'rack', '~> 2.2.0' or similar as a default/runtime dependency to your `Gemfile` + - Rubygems: add config.gems['rack'] = '~> 2.2.0' to your `config/warble.rb` + - CompatVersion errors: If you are getting java.lang.NoClassDefFoundError: org/jruby/CompatVersion errors at start-up you are probably running Warbler with a jruby-rack version which does not yet support JRuby 10+ - it @@ -270,25 +290,11 @@ If your app isn't working or starting up correctly: that probably means bundler is trying to switch versions dynamically during start-up because your `Gemfile.lock` implies a different locked version of bundler to that packaged with JRuby by default. - JRuby/Bundler running embedded inside a jar like this does not support switching bundler versions dynamically. + JRuby/Bundler running embedded inside a jar like this does not support switching bundler versions dynamically + - Ensure you're on warbler `2.1.2+` and/or jruby-rack `1.2.8+` which attempts to workaround this issue + - If that doesn't help, ensure you are using `BUNDLE_VERSION=system` when bundling/warbling your application to ensure + the identical embedded JRuby bundler version is used during warbling and runtime. - This may happen due to - - system gems for jruby installation upgradingg bundler to a newer version than packaged by default - - running bundle update --bundler - - using `BUNDLE_VERSION` to override bundle version which generating/editing your `Gemfile.lock` - - Options to address this - - use bundle config set version system / bundle config set disable_shared_gems to avoid bundler picking system versions - - ensure your `Gemfile.lock`'s BUNDLED WITH version matches the default bundler packaged with your `jruby-jars` version. - You can check inside the relevant `jruby-stdlib` jar or inside a clean installation dir from your Ruby version manager of choice. - - remove BUNDLED WITH entirely from `Gemfile.lock`. Sometimes bundler will add this back again; so not recommended in the longer term - -- Rack version compatibility - An exception happened during JRuby-Rack startup - no such file to load -- rack/chunked - You are trying to use Rack 3.x with a jruby-rack version that does not yet support Rack 3. Try upgrading to a compatible - jruby-rack version, or lock rack at a compatibile version with gem 'rack', '~> 2.2.0'. Note that Rack `2.2` requires Rails < `8.1`. - == Source You can get the Warbler source using Git, in any of the following ways: diff --git a/Rakefile b/Rakefile index 5633eea3..8564988b 100644 --- a/Rakefile +++ b/Rakefile @@ -21,11 +21,15 @@ task :spec => :jar task :default => :spec +jruby_rack_version = ENV['JRUBY_RACK_VERSION'] +java_ee_version = jruby_rack_version&.include?('[2.') ? 'ee11' : 'ee8' + # use Mavenfile to define :jar task require 'maven/ruby/maven' mvn = Maven::Ruby::Maven.new mvn << "-Djruby.version=#{JRUBY_VERSION}" -mvn << "-Dbundler.version=#{Bundler::VERSION}" +mvn << "-Djruby-rack.version=#{jruby_rack_version}" if jruby_rack_version +mvn << "-Djava.ee.version=#{java_ee_version}" mvn << '--no-transfer-progress' mvn << '--color=always' diff --git a/integration/pom.xml b/integration/pom.xml index 7d494dc9..5982088d 100644 --- a/integration/pom.xml +++ b/integration/pom.xml @@ -16,8 +16,8 @@ 2.1.3.pre 9.4.15.0 - 2.6.3 - 9.4.58.v20250814 + [1.2,1.2.99999) + ee8 @@ -28,12 +28,6 @@ - - rubygems - bundler - ${bundler.version} - gem - rubygems warbler @@ -46,6 +40,12 @@ ${jruby.version} gem + + rubygems + jruby-rack + ${jruby-rack.version} + gem + org.junit.jupiter junit-jupiter @@ -149,17 +149,11 @@ - org.eclipse.jetty - jetty-maven-plugin - ${jetty.version} + org.eclipse.jetty.${java.ee.version} + jetty-${java.ee.version}-maven-plugin - - / - 9966 warbler_stop - 0 - true jar @@ -197,7 +191,7 @@ pre-integration-test - deploy-war + start-war diff --git a/integration/rails7_test/pom.xml b/integration/rails7_test/pom.xml index 24cf63f8..ae0c9e47 100644 --- a/integration/rails7_test/pom.xml +++ b/integration/rails7_test/pom.xml @@ -28,8 +28,8 @@ - org.eclipse.jetty - jetty-maven-plugin + org.eclipse.jetty.${java.ee.version} + jetty-${java.ee.version}-maven-plugin start-jetty diff --git a/integration/rails7_test/src/main/ruby/.bundle/config b/integration/rails7_test/src/main/ruby/.bundle/config new file mode 100644 index 00000000..704b057f --- /dev/null +++ b/integration/rails7_test/src/main/ruby/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_VERSION: "system" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/integration/runnable_test/src/main/ruby/.bundle/config b/integration/runnable_test/src/main/ruby/.bundle/config new file mode 100644 index 00000000..704b057f --- /dev/null +++ b/integration/runnable_test/src/main/ruby/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_VERSION: "system" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/integration/runnable_w_bundler_test/src/main/ruby/.bundle/config b/integration/runnable_w_bundler_test/src/main/ruby/.bundle/config new file mode 100644 index 00000000..704b057f --- /dev/null +++ b/integration/runnable_w_bundler_test/src/main/ruby/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_VERSION: "system" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/integration/simple_rack_test/pom.xml b/integration/simple_rack_test/pom.xml index 41586fde..3a7f1c13 100644 --- a/integration/simple_rack_test/pom.xml +++ b/integration/simple_rack_test/pom.xml @@ -24,8 +24,8 @@ - org.eclipse.jetty - jetty-maven-plugin + org.eclipse.jetty.${java.ee.version} + jetty-${java.ee.version}-maven-plugin start-jetty diff --git a/integration/simple_rack_test/src/main/ruby/config/warble.rb b/integration/simple_rack_test/src/main/ruby/config/warble.rb index 09315124..ea2e7fc8 100644 --- a/integration/simple_rack_test/src/main/ruby/config/warble.rb +++ b/integration/simple_rack_test/src/main/ruby/config/warble.rb @@ -2,4 +2,5 @@ config.autodeploy_dir = "../../../target" config.jar_name = "simple_rack_test-1.0" config.bundler = false + config.gems << Gem::Dependency.new("rack", "~> 2.2.0") end diff --git a/spec/rails7_stub/.bundle/config b/spec/rails7_stub/.bundle/config new file mode 100644 index 00000000..704b057f --- /dev/null +++ b/spec/rails7_stub/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_VERSION: "system" +BUNDLE_DISABLE_SHARED_GEMS: "true" diff --git a/spec/sample_bundler/.bundle/config b/spec/sample_bundler/.bundle/config index de114412..386d1f58 100644 --- a/spec/sample_bundler/.bundle/config +++ b/spec/sample_bundler/.bundle/config @@ -1,5 +1,6 @@ --- +BUNDLE_VERSION: "system" +BUNDLE_DISABLE_SHARED_GEMS: "true" BUNDLE_FROZEN: "true" BUNDLE_PATH: "vendor/bundle" -BUNDLE_DISABLE_SHARED_GEMS: "1" BUNDLE_DEPLOYMENT: "false"