Prevent JRuby rubygems warnings from breaking the build

/cc @myronmarston 
Same here.  Also, there's some duplication with with the matching above.  Can we extract some common handling for that?