Generating a compiled war does not compile all controller files #72

brentsowers1 opened this Issue Jan 17, 2012 · 8 comments


None yet

4 participants

brentsowers1 commented Jan 17, 2012 edited

When I run "warble compiled war", .class files are not being generated for some of my controllers. I have 10 controller .rb files, and only 3 .class files are being generated. The .rb files for these controllers that don't have a .class are identical to the other .rb files, just a require to load the .class.

The behavior is consistent, it is always the same 7 controller files that do not have .class files in the WAR. And, running just "warble compiled" generates the same .class files, only 3 in controllers when there should be 10.

An unmodified scaffold controller will not have an associated .class file, so that's an easy way to reproduce this. I'm running JRuby 1.6.5 in 1.9 mode, and Rails 3.1.3.

--- Want to back this issue? **[Post a bounty on it!](** We accept bounties via [Bountysource](

Are you able to give a list of your app/controllers directory, on disk and inside the war after warble compiled war?
Do you have anything custom related to compiled files in config/warble.rb?


Here is the directory listing of the apps/controllers directory on disk. jrubies_controller is the pure scaffold controller.

application_controller.rb  oauth_clients_controller.rb  products_controller.rb      subscription_controller.rb
home_controller.rb         oauth_controller.rb          sessions_controller.rb

And here are the contents of the WEB-INF/app/controllers directory after extracting the WAR file locally:

application_controller.class  jrubies_controller.rb        products_controller.rb      subscription_controller.rb
application_controller.rb     oauth_clients_controller.rb  sessions_controller.class
home_controller.class         oauth_controller.rb          sessions_controller.rb

The only change I made to config/warble.rb was to add these lines:

config.dirs = %w(app config lib log vendor tmp script db/migrate)

config.includes = FileList["Rakefile"]

config.webxml.jruby.compat.version = "1.9"

I ran warble compiled war:debug, and I see this in the output, so it looks like it is attempting to compile these:

  pending_add: []
- !ruby/regexp '/(^|[\/\])CVS([\/\]|$)/'
- !ruby/regexp '/(^|[\/\]).svn([\/\]|$)/'
- !ruby/regexp '/.bak$/'
- !ruby/regexp '/~$/'
- *10802
- app/controllers/oauth_controller.rb
- app/controllers/settings_controller.rb
- app/controllers/oauth_logins_controller.rb
- app/controllers/sessions_controller.rb
- app/controllers/subscription_controller.rb
- app/controllers/application_controller.rb
- app/controllers/home_controller.rb
- app/controllers/jrubies_controller.rb
- app/controllers/accounts_controller.rb
- app/controllers/oauth_clients_controller.rb
- app/controllers/products_controller.rb
  WEB-INF/app/controllers/oauth_controller.rb -> <blob>
  WEB-INF/app/controllers/settings_controller.rb -> <blob>
  WEB-INF/app/controllers/oauth_logins_controller.rb -> <blob>
  WEB-INF/app/controllers/sessions_controller.rb -> <blob>
  WEB-INF/app/controllers/subscription_controller.rb -> <blob>
  WEB-INF/app/controllers/application_controller.rb -> <blob>
  WEB-INF/app/controllers/home_controller.rb -> <blob>
  WEB-INF/app/controllers/jrubies_controller.rb -> <blob>
  WEB-INF/app/controllers/accounts_controller.rb -> <blob>
  WEB-INF/app/controllers/oauth_clients_controller.rb -> <blob>
  WEB-INF/app/controllers/products_controller.rb -> <blob>


Was this issue ever resolved? I am running into the same problem where only a small percentage of my ruby files are getting compiled to .class files when I run "wable compiled" or "warble compiled war". The same files get compiled each time, so it's repeatable, but I have no idea why it compiles some files and not others. My environment is:
Warbler version 1.3.5
jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java]

Any ideas?
Thanks in advance!


I did some digging and I think the problem has to do with support for ruby 1.9. Ruby files that use the new 1.9 hash syntax {foo: "bar"} instead of the old way {:foo => "bar"} won't result in .class files. For example, the following works:

class SomeFoosController < ApplicationController
  def update
    respond_to do |format|
        format.html { redirect_to 'somwhere', :notice => 'some notice' }

but the following doesn't:

class SomeFoosController < ApplicationController
  def update
    respond_to do |format|
        format.html { redirect_to 'somwhere', notice: 'some notice' }

It should be noted that I have

config.webxml.jruby.compat.version = "1.9"

in my config/warble.rb

I hope this helps.


Thanks for figuring out what causes this behavior mvbrocato, I can at least get around the problem now.


I figured out a fix: if you change your run_javac method in jar.rb to the following, 1.9 sources compile fine:

def run_javac(config, compiled_ruby_files)
  # Need to use the version of JRuby in the application to compile it
  config.webxml.jruby.compat.version ||= "1.8"
  %x{java -classpath #{config.java_libs.join(File::PATH_SEPARATOR)} org.jruby.Main --#{config.webxml.jruby.compat.version} -S jrubyc \"#{compiled_ruby_files.join('" "')}\"}

It looks like config.webxml.jruby.compat.version was not being passed on to jrubyc. Nick, do you think you could check in a patch for this? I'm kind of a newb to Github otherwise I'd do it myself.

Thanks guys, hope this helps!


Thanks for that @mvbrocato. Yeah, in fact Warbler needs to be updated to be able to target/specify the app running in 1.9 mode across the board. I'll see if we can at least get this fix in sooner than later.

vanyak commented May 16, 2012

There is a pull request with the fix #90
Works for us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment