add jruby support by protobuf-java reflection API
diff --git a/ruby/Rakefile b/ruby/Rakefile
index ae7d805..7c1d849 100644
--- a/ruby/Rakefile
+++ b/ruby/Rakefile
@@ -1,20 +1,32 @@
-require "rake/extensiontask"
+require "rubygems"
+require "rubygems/package_task"
+require "rake/extensiontask" unless RUBY_PLATFORM == "java"
 require "rake/testtask"
 
 spec = Gem::Specification.load("google-protobuf.gemspec")
 
-Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
-  ext.ext_dir = "ext/google/protobuf_c"
-  ext.lib_dir = "lib/google"
+if RUBY_PLATFORM == "java"
+  task :clean do
+    system("mvn clean")
+  end
+
+  task :compile do
+    system("mvn package")
+  end
+else
+  Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
+    ext.ext_dir = "ext/google/protobuf_c"
+    ext.lib_dir = "lib/google"
+  end
+end
+
+Gem::PackageTask.new(spec) do |pkg|
 end
 
 Rake::TestTask.new(:test => :build) do |t|
   t.test_files = FileList["tests/*.rb"]
 end
 
-Gem::PackageTask.new(spec) do |pkg|
-end
-
 task :build => [:clean, :compile]
 task :default => [:build]