Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BUNDLE_VERSION: "system"
BUNDLE_DISABLE_SHARED_GEMS: "true"
22 changes: 19 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)'"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
!spec/rails7_stub/Gemfile.lock
*.sqlite3-*
!.bundle/config
.bundle
.idea
.polyglot.Mavenfile
Expand Down
12 changes: 6 additions & 6 deletions Mavenfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'],
Expand Down
54 changes: 30 additions & 24 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:

- <b>Jruby-Rack version not compatible with JRuby version</b>
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.

- <b>Rack version compatibility</b>
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 <tt>gem 'rack', '~> 2.2.0'</tt>. Note that Rack `2.2` requires Rails < `8.1`.

- <b>Rack missing at runtime</b>
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 <tt>gem 'rack', '~> 2.2.0'</tt> or similar as a default/runtime dependency to your `Gemfile`
- Rubygems: add <tt>config.gems['rack'] = '~> 2.2.0'</tt> to your `config/warble.rb`

- <b>CompatVersion errors:</b>
If you are getting <tt>java.lang.NoClassDefFoundError: org/jruby/CompatVersion</tt> errors at start-up
you are probably running Warbler with a jruby-rack version which does not yet support JRuby 10+ - it
Expand All @@ -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 <tt>bundle update --bundler</tt>
- using `BUNDLE_VERSION` to override bundle version which generating/editing your `Gemfile.lock`

Options to address this
- use <tt>bundle config set version system</tt> / <tt>bundle config set disable_shared_gems</tt> to avoid bundler picking system versions
- ensure your `Gemfile.lock`'s <tt>BUNDLED WITH</tt> 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 <tt>BUNDLED WITH</tt> entirely from `Gemfile.lock`. Sometimes bundler will add this back again; so not recommended in the longer term

- <b>Rack version compatibility</b>
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 <tt>gem 'rack', '~> 2.2.0'</tt>. Note that Rack `2.2` requires Rails < `8.1`.

== Source

You can get the Warbler source using Git, in any of the following ways:
Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
28 changes: 11 additions & 17 deletions integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<!-- Default versions, overridden from parent when running tests acros env -->
<warbler.version>2.1.3.pre</warbler.version>
<jruby.version>9.4.15.0</jruby.version>
<bundler.version>2.6.3</bundler.version>
<jetty.version>9.4.58.v20250814</jetty.version>
<jruby-rack.version>[1.2,1.2.99999)</jruby-rack.version>
<java.ee.version>ee8</java.ee.version>
</properties>

<repositories>
Expand All @@ -28,12 +28,6 @@
</repositories>

<dependencies>
<dependency>
<groupId>rubygems</groupId>
<artifactId>bundler</artifactId>
<version>${bundler.version}</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>warbler</artifactId>
Expand All @@ -46,6 +40,12 @@
<version>${jruby.version}</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-rack</artifactId>
<version>${jruby-rack.version}</version>
<type>gem</type>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down Expand Up @@ -149,17 +149,11 @@
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<groupId>org.eclipse.jetty.${java.ee.version}</groupId>
<artifactId>jetty-${java.ee.version}-maven-plugin</artifactId>
<configuration>
<webAppConfig>
<contextPath>/</contextPath>
</webAppConfig>
<stopPort>9966</stopPort>
<stopKey>warbler_stop</stopKey>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
<supportedPackagings>jar</supportedPackagings>
<systemProperties>
<systemProperty>
Expand Down Expand Up @@ -197,7 +191,7 @@
<phase>pre-integration-test</phase>
<goals>
<!-- Change to run-war to interactively play with the server without running tests -->
<goal>deploy-war</goal>
<goal>start-war</goal>
</goals>
</execution>
<execution>
Expand Down
4 changes: 2 additions & 2 deletions integration/rails7_test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<groupId>org.eclipse.jetty.${java.ee.version}</groupId>
<artifactId>jetty-${java.ee.version}-maven-plugin</artifactId>
<executions>
<execution>
<id>start-jetty</id>
Expand Down
3 changes: 3 additions & 0 deletions integration/rails7_test/src/main/ruby/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BUNDLE_VERSION: "system"
BUNDLE_DISABLE_SHARED_GEMS: "true"
3 changes: 3 additions & 0 deletions integration/runnable_test/src/main/ruby/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BUNDLE_VERSION: "system"
BUNDLE_DISABLE_SHARED_GEMS: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BUNDLE_VERSION: "system"
BUNDLE_DISABLE_SHARED_GEMS: "true"
4 changes: 2 additions & 2 deletions integration/simple_rack_test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<groupId>org.eclipse.jetty.${java.ee.version}</groupId>
<artifactId>jetty-${java.ee.version}-maven-plugin</artifactId>
<executions>
<execution>
<id>start-jetty</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions spec/rails7_stub/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
BUNDLE_VERSION: "system"
BUNDLE_DISABLE_SHARED_GEMS: "true"
3 changes: 2 additions & 1 deletion spec/sample_bundler/.bundle/config
Original file line number Diff line number Diff line change
@@ -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"
Loading