Navigation Menu

Skip to content

Commit

Permalink
Try to use Ehcache from CLASSPATH before bundled.
Browse files Browse the repository at this point in the history
  • Loading branch information
jvoegele committed Nov 2, 2010
1 parent e68d78e commit bc6f2a9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/ehcache/java.rb
@@ -1,6 +1,17 @@
module Ehcache
require 'java'

begin
# If Ehcache is already on the classpath, use it.
ehcache_version = Java::NetSfEhcacheUtil::ProductInfo.new.getVersion()
puts("Using Ehcache #{ehcache_version} from CLASSPATH")
rescue NameError
# If not, use the Ehcache bundled with the jruby-ehcache gem.
Dir["#{Ehcache::EHCACHE_HOME}/ext/**/*.jar"].sort.each {|l| require l}
ehcache_version = Java::NetSfEhcacheUtil::ProductInfo.new.getVersion()
puts("Using bundled Ehcache #{ehcache_version}")
end

module Ehcache
include_package 'net.sf.ehcache'

module Config
Expand Down

0 comments on commit bc6f2a9

Please sign in to comment.